Changeset 5914


Ignore:
Timestamp:
03/31/11 18:23:02 (11 years ago)
Author:
mkommend
Message:

#1418: Changed DataAnalysisSolutions and -Models and updated GenerateRowsToEvaluate method in SymbolicDataAnalysisEvaluator.

Location:
trunk/sources
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorClassification.cs

    r5809 r5914  
    142142      var model = new SupportVectorMachineModel(SVM.Training.Train(scaledProblem, parameter), rangeTransform, targetVariable, allowedInputVariables, problemData.ClassValues);
    143143
    144       return new SupportVectorClassificationSolution(model, problemData);
     144      return new SupportVectorClassificationSolution(model, (IClassificationProblemData)problemData.Clone());
    145145    }
    146146    #endregion
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorRegression.cs

    r5809 r5914  
    150150      SVM.Problem scaledProblem = SVM.Scaling.Scale(rangeTransform, problem);
    151151      var model = new SupportVectorMachineModel(SVM.Training.Train(scaledProblem, parameter), rangeTransform, targetVariable, allowedInputVariables);
    152       return new SupportVectorRegressionSolution(model, problemData);
     152      return new SupportVectorRegressionSolution(model, (IRegressionProblemData)problemData.Clone());
    153153    }
    154154    #endregion
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/kMeans/KMeansClustering.cs

    r5809 r5914  
    9595      if (info != 1) throw new ArgumentException("Error in calculation of k-Means clustering solution");
    9696
    97       KMeansClusteringSolution solution = new KMeansClusteringSolution(new KMeansClusteringModel(centers, allowedInputVariables), problemData);
     97      KMeansClusteringSolution solution = new KMeansClusteringSolution(new KMeansClusteringModel(centers, allowedInputVariables), (IClusteringProblemData)problemData.Clone());
    9898      return solution;
    9999    }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer.cs

    r5818 r5914  
    7676
    7777    protected override ISymbolicClassificationSolution CreateSolution(ISymbolicExpressionTree bestTree, double[] bestQuality) {
    78       var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
     78      var model = new SymbolicDiscriminantFunctionClassificationModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
    7979      if (ApplyLinearScaling.Value) {
    8080        SymbolicDiscriminantFunctionClassificationModel.Scale(model, ProblemDataParameter.ActualValue);
    8181      }
    82       return new SymbolicDiscriminantFunctionClassificationSolution(model, ProblemDataParameter.ActualValue);
     82      return new SymbolicDiscriminantFunctionClassificationSolution(model, (IClassificationProblemData)ProblemDataParameter.ActualValue.Clone());
    8383    }
    8484  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer.cs

    r5818 r5914  
    6565
    6666    protected override ISymbolicClassificationSolution CreateSolution(ISymbolicExpressionTree bestTree, double[] bestQualities) {
    67       var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
     67      var model = new SymbolicDiscriminantFunctionClassificationModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
    6868      if (ApplyLinearScaling.Value) {
    6969        SymbolicDiscriminantFunctionClassificationModel.Scale(model, ProblemDataParameter.ActualValue);
    7070      }
    71       return new SymbolicDiscriminantFunctionClassificationSolution(model, ProblemDataParameter.ActualValue);
     71      return new SymbolicDiscriminantFunctionClassificationSolution(model, (IClassificationProblemData)ProblemDataParameter.ActualValue.Clone());
    7272    }
    7373  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer.cs

    r5818 r5914  
    7474
    7575    protected override ISymbolicClassificationSolution CreateSolution(ISymbolicExpressionTree bestTree, double bestQuality) {
    76       var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
     76      var model = new SymbolicDiscriminantFunctionClassificationModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
    7777      if (ApplyLinearScaling.Value) {
    7878        SymbolicDiscriminantFunctionClassificationModel.Scale(model, ProblemDataParameter.ActualValue);
    7979      }
    80       return new SymbolicDiscriminantFunctionClassificationSolution(model, ProblemDataParameter.ActualValue);
     80      return new SymbolicDiscriminantFunctionClassificationSolution(model, (IClassificationProblemData)ProblemDataParameter.ActualValue.Clone());
    8181    }
    8282  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer.cs

    r5818 r5914  
    6565
    6666    protected override ISymbolicClassificationSolution CreateSolution(ISymbolicExpressionTree bestTree, double bestQuality) {
    67       var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
     67      var model = new SymbolicDiscriminantFunctionClassificationModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
    6868      if (ApplyLinearScaling.Value) {
    6969        SymbolicDiscriminantFunctionClassificationModel.Scale(model, ProblemDataParameter.ActualValue);
    7070      }
    71       return new SymbolicDiscriminantFunctionClassificationSolution(model, ProblemDataParameter.ActualValue);
     71      return new SymbolicDiscriminantFunctionClassificationSolution(model, (IClassificationProblemData)ProblemDataParameter.ActualValue.Clone());
    7272    }
    7373  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveTrainingBestSolutionAnalyzer.cs

    r5818 r5914  
    7676
    7777    protected override ISymbolicRegressionSolution CreateSolution(ISymbolicExpressionTree bestTree, double[] bestQuality) {
    78       var model = new SymbolicRegressionModel(bestTree, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
     78      var model = new SymbolicRegressionModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
    7979      if (ApplyLinearScaling.Value)
    8080        SymbolicRegressionModel.Scale(model, ProblemDataParameter.ActualValue);
    81       return new SymbolicRegressionSolution(model, ProblemDataParameter.ActualValue);
     81      return new SymbolicRegressionSolution(model, (IRegressionProblemData)ProblemDataParameter.ActualValue.Clone());
    8282    }
    8383  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer.cs

    r5818 r5914  
    6565
    6666    protected override ISymbolicRegressionSolution CreateSolution(ISymbolicExpressionTree bestTree, double[] bestQuality) {
    67       var model = new SymbolicRegressionModel(bestTree, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
     67      var model = new SymbolicRegressionModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
    6868      if (ApplyLinearScaling.Value)
    6969        SymbolicRegressionModel.Scale(model, ProblemDataParameter.ActualValue);
    70       return new SymbolicRegressionSolution(model, ProblemDataParameter.ActualValue);
     70      return new SymbolicRegressionSolution(model, (IRegressionProblemData)ProblemDataParameter.ActualValue.Clone());
    7171    }
    7272  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveTrainingBestSolutionAnalyzer.cs

    r5818 r5914  
    7575
    7676    protected override ISymbolicRegressionSolution CreateSolution(ISymbolicExpressionTree bestTree, double bestQuality) {
    77       var model = new SymbolicRegressionModel(bestTree, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
     77      var model = new SymbolicRegressionModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
    7878      if (ApplyLinearScaling.Value)
    7979        SymbolicRegressionModel.Scale(model, ProblemDataParameter.ActualValue);
    80       return new SymbolicRegressionSolution(model, ProblemDataParameter.ActualValue);
     80      return new SymbolicRegressionSolution(model, (IRegressionProblemData)ProblemDataParameter.ActualValue.Clone());
    8181    }
    8282  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer.cs

    r5818 r5914  
    6767
    6868    protected override ISymbolicRegressionSolution CreateSolution(ISymbolicExpressionTree bestTree, double bestQuality) {
    69       var model = new SymbolicRegressionModel(bestTree, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
     69      var model = new SymbolicRegressionModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
    7070      if (ApplyLinearScaling.Value)
    7171        SymbolicRegressionModel.Scale(model, ProblemDataParameter.ActualValue);
    72       return new SymbolicRegressionSolution(model, ProblemDataParameter.ActualValue);
     72      return new SymbolicRegressionSolution(model, (IRegressionProblemData)ProblemDataParameter.ActualValue.Clone());
    7373    }
    7474  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionModel.cs

    r5894 r5914  
    2121
    2222using System.Collections.Generic;
    23 using System.Linq;
    2423using HeuristicLab.Common;
    2524using HeuristicLab.Core;
    26 using HeuristicLab.Data;
    2725using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    28 using HeuristicLab.Operators;
    29 using HeuristicLab.Parameters;
    3026using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    31 using HeuristicLab.Optimization;
    32 using System;
    3327
    3428namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolution.cs

    r5818 r5914  
    2020#endregion
    2121
    22 using System.Collections.Generic;
    23 using System.Linq;
     22using System;
    2423using HeuristicLab.Common;
    2524using HeuristicLab.Core;
    2625using HeuristicLab.Data;
    27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    28 using HeuristicLab.Operators;
    29 using HeuristicLab.Parameters;
     26using HeuristicLab.Optimization;
    3027using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    31 using HeuristicLab.Optimization;
    32 using System;
    3328
    3429namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Evaluators/SymbolicDataAnalysisEvaluator.cs

    r5906 r5914  
    9090
    9191    protected IEnumerable<int> GenerateRowsToEvaluate() {
    92       int seed = RandomParameter.ActualValue.Next();
     92      return GenerateRowsToEvaluate(RelativeNumberOfEvaluatedSamplesParameter.ActualValue.Value);
     93    }
     94
     95    protected IEnumerable<int> GenerateRowsToEvaluate(double percentageOfRows) {
     96
     97
     98      IEnumerable<int> rows;
    9399      int samplesStart = EvaluationPartitionParameter.ActualValue.Start;
    94100      int samplesEnd = EvaluationPartitionParameter.ActualValue.End;
     
    97103
    98104      if (samplesEnd < samplesStart) throw new ArgumentException("Start value is larger than end value.");
    99       int count = (int)((samplesEnd - samplesStart) * RelativeNumberOfEvaluatedSamplesParameter.ActualValue.Value);
    100       if (count == 0) count = 1;
    101       return RandomEnumerable.SampleRandomNumbers(seed, samplesStart, samplesEnd, count)
    102         .Where(i => i < testPartitionStart || testPartitionEnd <= i);
     105
     106      if (percentageOfRows.IsAlmost(1.0))
     107        rows = Enumerable.Range(samplesStart, samplesEnd - samplesStart);
     108      else {
     109        int seed = RandomParameter.ActualValue.Next();
     110        int count = (int)((samplesEnd - samplesStart) * percentageOfRows);
     111        if (count == 0) count = 1;
     112        rows = RandomEnumerable.SampleRandomNumbers(seed, samplesStart, samplesEnd, count);
     113      }
     114
     115      return rows.Where(i => i < testPartitionStart || testPartitionEnd <= i);
    103116    }
    104117  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisModel.cs

    r5809 r5914  
    2020#endregion
    2121
    22 using System.Collections.Generic;
    23 using System.Linq;
     22using System.Drawing;
    2423using HeuristicLab.Common;
    2524using HeuristicLab.Core;
    26 using HeuristicLab.Data;
    2725using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    28 using HeuristicLab.Operators;
    29 using HeuristicLab.Parameters;
    3026using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    31 using HeuristicLab.Optimization;
    32 using System;
    33 using System.Drawing;
    3427
    3528namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisSolution.cs

    r5909 r5914  
    8080      name = ItemName;
    8181      description = ItemDescription;
    82       IDataAnalysisModel modelClone = (IDataAnalysisModel)model.Clone();
    83       IDataAnalysisProblemData problemDataClone = (IDataAnalysisProblemData)problemData.Clone();
    84       Add(new Result(ModelResultName, "The symbolic data analysis model.", modelClone));
    85       Add(new Result(ProblemDataResultName, "The symbolic data analysis problem data.", problemDataClone));
     82      Add(new Result(ModelResultName, "The symbolic data analysis model.", model));
     83      Add(new Result(ProblemDataResultName, "The symbolic data analysis problem data.", problemData));
    8684
    87       problemDataClone.Changed += new EventHandler(ProblemData_Changed);
     85      problemData.Changed += new EventHandler(ProblemData_Changed);
    8886    }
    8987
Note: See TracChangeset for help on using the changeset viewer.