Changeset 12848 for branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredNestedTreeSizeEvaluator.cs
- Timestamp:
- 08/12/15 10:35:02 (9 years ago)
- File:
-
- 1 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;
Note: See TracChangeset
for help on using the changeset viewer.