Changeset 12848 for branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective
- Timestamp:
- 08/12/15 10:35:02 (9 years ago)
- Location:
- branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredNestedTreeSizeEvaluator.cs
r12147 r12848 27 27 using HeuristicLab.Data; 28 28 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 29 using HeuristicLab.Parameters;30 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 31 30 … … 34 33 [StorableClass] 35 34 public class PearsonRSquaredNestedTreeSizeEvaluator : SymbolicRegressionMultiObjectiveEvaluator { 36 private const string useConstantOptimizationParameterName = "Use constant optimization";37 public IFixedValueParameter<BoolValue> UseConstantOptimizationParameter {38 get { return (IFixedValueParameter<BoolValue>)Parameters[useConstantOptimizationParameterName]; }39 }40 public bool UseConstantOptimization {41 get { return UseConstantOptimizationParameter.Value.Value; }42 set { UseConstantOptimizationParameter.Value.Value = value; }43 }44 45 35 [StorableConstructor] 46 36 protected PearsonRSquaredNestedTreeSizeEvaluator(bool deserializing) : base(deserializing) { } … … 52 42 } 53 43 54 public PearsonRSquaredNestedTreeSizeEvaluator() 55 : base() { 56 Parameters.Add(new FixedValueParameter<BoolValue>(useConstantOptimizationParameterName, "", new BoolValue(false))); 57 } 44 public PearsonRSquaredNestedTreeSizeEvaluator() : base() { } 58 45 59 46 public override IEnumerable<bool> Maximization { get { return new bool[2] { true, false }; } } … … 71 58 } 72 59 73 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value );60 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces); 74 61 QualitiesParameter.ActualValue = new DoubleArray(qualities); 75 62 return base.InstrumentedApply(); 76 63 } 77 64 78 public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling ) {65 public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int decimalPlaces) { 79 66 double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, problemData, rows, applyLinearScaling); 80 r2 = Math.Round(r2, 3); 67 if (decimalPlaces >= 0) 68 r2 = Math.Round(r2, decimalPlaces); 81 69 return new double[2] { r2, solution.IterateNodesPostfix().Sum(n => n.GetLength()) }; 82 70 } … … 87 75 ApplyLinearScalingParameter.ExecutionContext = context; 88 76 89 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows, ApplyLinearScalingParameter.ActualValue.Value );77 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows, ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces); 90 78 91 79 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredNumberOfVariablesEvaluator.cs
r12147 r12848 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using System.Security.Cryptography;26 25 using HeuristicLab.Common; 27 26 using HeuristicLab.Core; 28 27 using HeuristicLab.Data; 29 28 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 30 using HeuristicLab.Parameters;31 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 32 30 … … 35 33 [StorableClass] 36 34 public class PearsonRSquaredNumberOfVariablesEvaluator : SymbolicRegressionMultiObjectiveEvaluator { 37 private const string useConstantOptimizationParameterName = "Use constant optimization";38 public IFixedValueParameter<BoolValue> UseConstantOptimizationParameter {39 get { return (IFixedValueParameter<BoolValue>)Parameters[useConstantOptimizationParameterName]; }40 }41 public bool UseConstantOptimization {42 get { return UseConstantOptimizationParameter.Value.Value; }43 set { UseConstantOptimizationParameter.Value.Value = value; }44 }45 46 35 [StorableConstructor] 47 36 protected PearsonRSquaredNumberOfVariablesEvaluator(bool deserializing) : base(deserializing) { } … … 53 42 } 54 43 55 public PearsonRSquaredNumberOfVariablesEvaluator() 56 : base() { 57 Parameters.Add(new FixedValueParameter<BoolValue>(useConstantOptimizationParameterName, "", new BoolValue(false))); 58 } 44 public PearsonRSquaredNumberOfVariablesEvaluator() : base() { } 59 45 60 46 public override IEnumerable<bool> Maximization { get { return new bool[2] { true, false }; } } … … 71 57 SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, solution, problemData, rows, applyLinearScaling, 5, estimationLimits.Upper, estimationLimits.Lower); 72 58 } 73 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value );59 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces); 74 60 QualitiesParameter.ActualValue = new DoubleArray(qualities); 75 61 return base.InstrumentedApply(); 76 62 } 77 63 78 public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling ) {64 public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int decimalPlaces) { 79 65 double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, problemData, rows, applyLinearScaling); 80 r2 = Math.Round(r2, 3); 66 if (decimalPlaces >= 0) 67 r2 = Math.Round(r2, decimalPlaces); 81 68 return new double[2] { r2, solution.IterateNodesPostfix().OfType<VariableTreeNode>().Count() }; 82 69 } … … 87 74 ApplyLinearScalingParameter.ExecutionContext = context; 88 75 89 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows, ApplyLinearScalingParameter.ActualValue.Value );76 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows, ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces); 90 77 91 78 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredTreeComplexityEvaluator.cs
r12147 r12848 26 26 using HeuristicLab.Data; 27 27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 using HeuristicLab.Parameters;29 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 29 … … 33 32 [StorableClass] 34 33 public class PearsonRSquaredTreeComplexityEvaluator : SymbolicRegressionMultiObjectiveEvaluator { 35 private const string useConstantOptimizationParameterName = "Use constant optimization";36 public IFixedValueParameter<BoolValue> UseConstantOptimizationParameter {37 get { return (IFixedValueParameter<BoolValue>)Parameters[useConstantOptimizationParameterName]; }38 }39 public bool UseConstantOptimization {40 get { return UseConstantOptimizationParameter.Value.Value; }41 set { UseConstantOptimizationParameter.Value.Value = value; }42 }43 44 34 [StorableConstructor] 45 35 protected PearsonRSquaredTreeComplexityEvaluator(bool deserializing) : base(deserializing) { } … … 51 41 } 52 42 53 public PearsonRSquaredTreeComplexityEvaluator() 54 : base() { 55 Parameters.Add(new FixedValueParameter<BoolValue>(useConstantOptimizationParameterName, "", new BoolValue(false))); 56 } 57 58 [StorableHook(HookType.AfterDeserialization)] 59 private void AfterDeserialization() { 60 if (!Parameters.ContainsKey(useConstantOptimizationParameterName)) { 61 Parameters.Add(new FixedValueParameter<BoolValue>(useConstantOptimizationParameterName, "", new BoolValue(false))); 62 } 63 } 43 public PearsonRSquaredTreeComplexityEvaluator() : base() { } 64 44 65 45 public override IEnumerable<bool> Maximization { get { return new bool[2] { true, false }; } } … … 76 56 SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, solution, problemData, rows, applyLinearScaling, 5, estimationLimits.Upper, estimationLimits.Lower); 77 57 } 78 double[] qualities = Calculate(interpreter, solution, estimationLimits.Lower, estimationLimits.Upper, problemData, rows, applyLinearScaling );58 double[] qualities = Calculate(interpreter, solution, estimationLimits.Lower, estimationLimits.Upper, problemData, rows, applyLinearScaling, DecimalPlaces); 79 59 QualitiesParameter.ActualValue = new DoubleArray(qualities); 80 60 return base.InstrumentedApply(); 81 61 } 82 62 83 public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling ) {63 public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int decimalPlaces) { 84 64 double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, problemData, rows, applyLinearScaling); 85 r2 = Math.Round(r2, 3); 65 if (decimalPlaces >= 0) 66 r2 = Math.Round(r2, decimalPlaces); 86 67 return new double[2] { r2, SymbolicDataAnalysisModelComplexityAnalyzer.CalculateComplexity(solution.Root.GetSubtree(0).GetSubtree(0)) }; 87 68 } … … 92 73 ApplyLinearScalingParameter.ExecutionContext = context; 93 74 94 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows, ApplyLinearScalingParameter.ActualValue.Value );75 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows, ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces); 95 76 96 77 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveEvaluator.cs
r12130 r12848 22 22 23 23 using HeuristicLab.Common; 24 using HeuristicLab.Core; 25 using HeuristicLab.Data; 26 using HeuristicLab.Parameters; 24 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 25 29 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression { 30 [StorableClass] 26 31 public abstract class SymbolicRegressionMultiObjectiveEvaluator : SymbolicDataAnalysisMultiObjectiveEvaluator<IRegressionProblemData>, ISymbolicRegressionMultiObjectiveEvaluator { 32 private const string DecimalPlacesParameterName = "Decimal Places"; 33 private const string UseConstantOptimizationParameterName = "Use constant optimization"; 34 35 public IFixedValueParameter<IntValue> DecimalPlacesParameter { 36 get { return (IFixedValueParameter<IntValue>)Parameters[DecimalPlacesParameterName]; } 37 } 38 public IFixedValueParameter<BoolValue> UseConstantOptimizationParameter { 39 get { return (IFixedValueParameter<BoolValue>)Parameters[UseConstantOptimizationParameterName]; } 40 } 41 42 public int DecimalPlaces { 43 get { return DecimalPlacesParameter.Value.Value; } 44 set { DecimalPlacesParameter.Value.Value = value; } 45 } 46 public bool UseConstantOptimization { 47 get { return UseConstantOptimizationParameter.Value.Value; } 48 set { UseConstantOptimizationParameter.Value.Value = value; } 49 } 50 27 51 [StorableConstructor] 28 52 protected SymbolicRegressionMultiObjectiveEvaluator(bool deserializing) : base(deserializing) { } … … 31 55 } 32 56 33 protected SymbolicRegressionMultiObjectiveEvaluator() : base() { } 57 protected SymbolicRegressionMultiObjectiveEvaluator() 58 : base() { 59 Parameters.Add(new FixedValueParameter<IntValue>(DecimalPlacesParameterName, "The number of decimal places used for rounding the quality values.", new IntValue(5)) { Hidden = true }); 60 Parameters.Add(new FixedValueParameter<BoolValue>(UseConstantOptimizationParameterName, "", new BoolValue(false))); 61 } 62 63 [StorableHook(HookType.AfterDeserialization)] 64 private void AfterDeserialization() { 65 if (!Parameters.ContainsKey(UseConstantOptimizationParameterName)) { 66 Parameters.Add(new FixedValueParameter<BoolValue>(UseConstantOptimizationParameterName, "", new BoolValue(false))); 67 } 68 if (!Parameters.ContainsKey(DecimalPlacesParameterName)) { 69 Parameters.Add(new FixedValueParameter<IntValue>(DecimalPlacesParameterName, "The number of decimal places used for rounding the quality values.", new IntValue(-1)) { Hidden = true }); 70 } 71 } 34 72 } 35 73 } -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs
r12130 r12848 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, 5, 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; -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs
r12147 r12848 26 26 using HeuristicLab.Data; 27 27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 using HeuristicLab.Parameters;29 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 29 … … 33 32 [StorableClass] 34 33 public class SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator : SymbolicRegressionMultiObjectiveEvaluator { 35 private const string useConstantOptimizationParameterName = "Use constant optimization";36 public IFixedValueParameter<BoolValue> UseConstantOptimizationParameter {37 get { return (IFixedValueParameter<BoolValue>)Parameters[useConstantOptimizationParameterName]; }38 }39 public bool UseConstantOptimization {40 get { return UseConstantOptimizationParameter.Value.Value; }41 set { UseConstantOptimizationParameter.Value.Value = value; }42 }43 44 34 [StorableConstructor] 45 35 protected SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator(bool deserializing) : base(deserializing) { } … … 51 41 } 52 42 53 public SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator() : base() 54 { 55 Parameters.Add(new FixedValueParameter<BoolValue>(useConstantOptimizationParameterName, "", new BoolValue(false))); 56 } 57 58 [StorableHook(HookType.AfterDeserialization)] 59 private void AfterDeserialization() { 60 if (!Parameters.ContainsKey(useConstantOptimizationParameterName)) { 61 Parameters.Add(new FixedValueParameter<BoolValue>(useConstantOptimizationParameterName, "", new BoolValue(false))); 62 } 63 } 43 public SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator() : base() { } 64 44 65 45 public override IEnumerable<bool> Maximization { get { return new bool[2] { true, false }; } } … … 76 56 SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, solution, problemData, rows, applyLinearScaling, 5, estimationLimits.Upper, estimationLimits.Lower); 77 57 } 78 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value );58 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces); 79 59 QualitiesParameter.ActualValue = new DoubleArray(qualities); 80 60 return base.InstrumentedApply(); 81 61 } 82 62 83 public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling ) {63 public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int decimalPlaces) { 84 64 double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, problemData, rows, applyLinearScaling); 85 r2 = Math.Round(r2, 3); 65 if (decimalPlaces >= 0) 66 r2 = Math.Round(r2, decimalPlaces); 86 67 return new double[2] { r2, solution.Length }; 87 68 } … … 92 73 ApplyLinearScalingParameter.ExecutionContext = context; 93 74 94 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows, ApplyLinearScalingParameter.ActualValue.Value );75 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows, ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces); 95 76 96 77 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
Note: See TracChangeset
for help on using the changeset viewer.