- Timestamp:
- 02/24/22 20:33:45 (3 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
-
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression
- Property svn:mergeinfo changed
-
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4
- Property svn:mergeinfo changed
-
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredAverageSimilarityEvaluator.cs
r18132 r18220 70 70 public override IOperation InstrumentedApply() { 71 71 IEnumerable<int> rows = GenerateRowsToEvaluate(); 72 var solution= SymbolicExpressionTreeParameter.ActualValue;72 var tree = SymbolicExpressionTreeParameter.ActualValue; 73 73 var problemData = ProblemDataParameter.ActualValue; 74 74 var interpreter = SymbolicDataAnalysisTreeInterpreterParameter.ActualValue; … … 77 77 78 78 if (UseParameterOptimization) { 79 SymbolicRegressionParameterOptimizationEvaluator.OptimizeParameters(interpreter, solution, problemData, rows, applyLinearScaling, ParameterOptimizationIterations, updateVariableWeights: ParameterOptimizationUpdateVariableWeights, lowerEstimationLimit: estimationLimits.Lower, upperEstimationLimit: estimationLimits.Upper);79 SymbolicRegressionParameterOptimizationEvaluator.OptimizeParameters(interpreter, tree, problemData, rows, applyLinearScaling, ParameterOptimizationIterations, updateVariableWeights: ParameterOptimizationUpdateVariableWeights, lowerEstimationLimit: estimationLimits.Lower, upperEstimationLimit: estimationLimits.Upper); 80 80 } 81 81 82 double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(interpreter, solution, estimationLimits.Lower, estimationLimits.Upper, problemData, rows, applyLinearScaling); 82 double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate( 83 tree, problemData, rows, interpreter, applyLinearScaling, 84 estimationLimits.Lower, estimationLimits.Upper); 83 85 84 86 if (DecimalPlaces >= 0) … … 107 109 var applyLinearScaling = ApplyLinearScalingParameter.ActualValue.Value; 108 110 109 double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, estimationLimits.Lower, estimationLimits.Upper, problemData, rows, applyLinearScaling); 111 double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate( 112 tree, problemData, rows, 113 SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, 114 applyLinearScaling, 115 estimationLimits.Lower, estimationLimits.Upper); 110 116 111 117 lock (locker) { -
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredNestedTreeSizeEvaluator.cs
r18132 r18220 63 63 } 64 64 65 public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int decimalPlaces) { 66 double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, problemData, rows, applyLinearScaling); 65 public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree tree, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int decimalPlaces) { 66 double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate( 67 tree, problemData, rows, 68 interpreter, applyLinearScaling, 69 lowerEstimationLimit, upperEstimationLimit); 67 70 if (decimalPlaces >= 0) 68 71 r2 = Math.Round(r2, decimalPlaces); 69 return new double[2] { r2, solution.IterateNodesPostfix().Sum(n => n.GetLength()) }; // sum of the length of the whole sub-tree for each node72 return new double[2] { r2, tree.IterateNodesPostfix().Sum(n => n.GetLength()) }; // sum of the length of the whole sub-tree for each node 70 73 } 71 74 -
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredNumberOfVariablesEvaluator.cs
r18132 r18220 62 62 } 63 63 64 public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int decimalPlaces) { 65 double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, problemData, rows, applyLinearScaling); 64 public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree tree, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int decimalPlaces) { 65 double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate( 66 tree, problemData, rows, interpreter, applyLinearScaling, 67 lowerEstimationLimit, upperEstimationLimit); 66 68 if (decimalPlaces >= 0) 67 69 r2 = Math.Round(r2, decimalPlaces); 68 return new double[2] { r2, solution.IterateNodesPostfix().OfType<IVariableTreeNode>().Count() }; // count the number of variables70 return new double[2] { r2, tree.IterateNodesPostfix().OfType<IVariableTreeNode>().Count() }; // count the number of variables 69 71 } 70 72 -
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredTreeComplexityEvaluator.cs
r18132 r18220 61 61 } 62 62 63 public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int decimalPlaces) { 64 double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, problemData, rows, applyLinearScaling); 63 public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree tree, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int decimalPlaces) { 64 double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate( 65 tree, problemData, rows, 66 interpreter, applyLinearScaling, 67 lowerEstimationLimit, upperEstimationLimit); 65 68 if (decimalPlaces >= 0) 66 69 r2 = Math.Round(r2, decimalPlaces); 67 return new double[2] { r2, SymbolicDataAnalysisModelComplexityCalculator.CalculateComplexity( solution) };70 return new double[2] { r2, SymbolicDataAnalysisModelComplexityCalculator.CalculateComplexity(tree) }; 68 71 } 69 72 -
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs
r18132 r18220 22 22 using System; 23 23 using System.Collections.Generic; 24 using HEAL.Attic; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 27 using HeuristicLab.Data; 27 28 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 using HEAL.Attic;29 29 30 30 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression { … … 47 47 public override IOperation InstrumentedApply() { 48 48 IEnumerable<int> rows = GenerateRowsToEvaluate(); 49 var solution= SymbolicExpressionTreeParameter.ActualValue;49 var tree = SymbolicExpressionTreeParameter.ActualValue; 50 50 var problemData = ProblemDataParameter.ActualValue; 51 51 var interpreter = SymbolicDataAnalysisTreeInterpreterParameter.ActualValue; … … 54 54 55 55 if (UseParameterOptimization) { 56 SymbolicRegressionParameterOptimizationEvaluator.OptimizeParameters(interpreter, solution, problemData, rows, applyLinearScaling, ParameterOptimizationIterations, updateVariableWeights: ParameterOptimizationUpdateVariableWeights, lowerEstimationLimit: estimationLimits.Lower, upperEstimationLimit: estimationLimits.Upper);56 SymbolicRegressionParameterOptimizationEvaluator.OptimizeParameters(interpreter, tree, problemData, rows, applyLinearScaling, ParameterOptimizationIterations, updateVariableWeights: ParameterOptimizationUpdateVariableWeights, lowerEstimationLimit: estimationLimits.Lower, upperEstimationLimit: estimationLimits.Upper); 57 57 } 58 58 59 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces); 59 double[] qualities = Calculate( 60 tree, ProblemDataParameter.ActualValue, 61 rows, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, 62 ApplyLinearScalingParameter.ActualValue.Value, 63 EstimationLimitsParameter.ActualValue.Lower, 64 EstimationLimitsParameter.ActualValue.Upper, 65 DecimalPlaces); 60 66 QualitiesParameter.ActualValue = new DoubleArray(qualities); 61 67 return base.InstrumentedApply(); 62 68 } 63 69 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); 70 public static double[] Calculate( 71 ISymbolicExpressionTree tree, 72 IRegressionProblemData problemData, 73 IEnumerable<int> rows, 74 ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, 75 bool applyLinearScaling, 76 double lowerEstimationLimit, double upperEstimationLimit, 77 int decimalPlaces) { 78 var mse = SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator.Calculate( 79 tree, problemData, rows, 80 interpreter, applyLinearScaling, 81 lowerEstimationLimit, 82 upperEstimationLimit); 67 83 68 84 if (decimalPlaces >= 0) 69 85 mse = Math.Round(mse, decimalPlaces); 70 86 71 return new double[2] { mse, solution.Length };87 return new double[2] { mse, tree.Length }; 72 88 } 73 89 … … 77 93 ApplyLinearScalingParameter.ExecutionContext = context; 78 94 79 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows, ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces); 95 double[] quality = Calculate( 96 tree, problemData, rows, 97 SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, 98 ApplyLinearScalingParameter.ActualValue.Value, 99 EstimationLimitsParameter.ActualValue.Lower, 100 EstimationLimitsParameter.ActualValue.Upper, DecimalPlaces); 80 101 81 102 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; -
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs
r18132 r18220 61 61 } 62 62 63 public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int decimalPlaces) { 64 double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, problemData, rows, applyLinearScaling); 63 public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree tree, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int decimalPlaces) { 64 double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate( 65 tree, problemData, rows, interpreter, applyLinearScaling, 66 lowerEstimationLimit, upperEstimationLimit); 65 67 if (decimalPlaces >= 0) 66 68 r2 = Math.Round(r2, decimalPlaces); 67 return new double[2] { r2, solution.Length };69 return new double[2] { r2, tree.Length }; 68 70 } 69 71
Note: See TracChangeset
for help on using the changeset viewer.