Changeset 13241 for trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs
- Timestamp:
- 11/18/15 10:39:47 (9 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
/branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 merged eligible /branches/HLScript/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression merged eligible /stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression merged eligible /branches/Benchmarking/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 6917-7005 /branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 4656-4721 /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 5471-5473 /branches/DataAnalysis SolutionEnsembles/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 5815-6180 /branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 4458-4459,4462,4464 /branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 10085-11101 /branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 6284-6795 /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 5060 /branches/HeuristicLab.TreeSimplifier/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 8388-8942 /branches/LogResidualEvaluator/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 10202-10483 /branches/NET40/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 5138-5162 /branches/ParallelEngine/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 5175-5192 /branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 7748-7810 /branches/QAPAlgorithms/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 6350-6627 /branches/Restructure trunk solution/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 6828 /branches/SpectralKernelForGaussianProcesses/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 10204-10479 /branches/SuccessProgressAnalysis/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 5370-5682 /branches/Trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 6829-6865 /branches/VNS/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 5594-5752 /branches/histogram/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 5959-6341
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs
r12012 r13241 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using HeuristicLab.Common; … … 47 48 IEnumerable<int> rows = GenerateRowsToEvaluate(); 48 49 var solution = SymbolicExpressionTreeParameter.ActualValue; 49 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value); 50 var problemData = ProblemDataParameter.ActualValue; 51 var interpreter = SymbolicDataAnalysisTreeInterpreterParameter.ActualValue; 52 var estimationLimits = EstimationLimitsParameter.ActualValue; 53 var applyLinearScaling = ApplyLinearScalingParameter.ActualValue.Value; 54 55 if (UseConstantOptimization) { 56 SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, solution, problemData, rows, applyLinearScaling, ConstantOptimizationIterations, estimationLimits.Upper, estimationLimits.Lower); 57 } 58 59 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces); 50 60 QualitiesParameter.ActualValue = new DoubleArray(qualities); 51 61 return base.InstrumentedApply(); 52 62 } 53 63 54 public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling) { 55 IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows); 56 IEnumerable<double> targetValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows); 57 OnlineCalculatorError errorState; 64 public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int decimalPlaces) { 65 var mse = SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator.Calculate(interpreter, solution, lowerEstimationLimit, 66 upperEstimationLimit, problemData, rows, applyLinearScaling); 58 67 59 double mse; 60 if (applyLinearScaling) { 61 var mseCalculator = new OnlineMeanSquaredErrorCalculator(); 62 CalculateWithScaling(targetValues, estimatedValues, lowerEstimationLimit, upperEstimationLimit, mseCalculator, problemData.Dataset.Rows); 63 errorState = mseCalculator.ErrorState; 64 mse = mseCalculator.MeanSquaredError; 65 } else { 66 IEnumerable<double> boundedEstimatedValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit); 67 mse = OnlineMeanSquaredErrorCalculator.Calculate(targetValues, boundedEstimatedValues, out errorState); 68 } 69 if (errorState != OnlineCalculatorError.None) mse = double.NaN; 68 if (decimalPlaces >= 0) 69 mse = Math.Round(mse, decimalPlaces); 70 70 71 return new double[2] { mse, solution.Length }; 71 72 } … … 76 77 ApplyLinearScalingParameter.ExecutionContext = context; 77 78 78 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows, ApplyLinearScalingParameter.ActualValue.Value );79 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows, ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces); 79 80 80 81 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
Note: See TracChangeset
for help on using the changeset viewer.