Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/12/15 10:35:02 (9 years ago)
Author:
mkommend
Message:

#2175: Merged trunk changes and extracted parameters of evaluators to their base class.

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  
    2727using HeuristicLab.Data;
    2828using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    29 using HeuristicLab.Parameters;
    3029using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3130
     
    3433  [StorableClass]
    3534  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 
    4535    [StorableConstructor]
    4636    protected PearsonRSquaredNestedTreeSizeEvaluator(bool deserializing) : base(deserializing) { }
     
    5242    }
    5343
    54     public PearsonRSquaredNestedTreeSizeEvaluator()
    55       : base() {
    56       Parameters.Add(new FixedValueParameter<BoolValue>(useConstantOptimizationParameterName, "", new BoolValue(false)));
    57     }
     44    public PearsonRSquaredNestedTreeSizeEvaluator() : base() { }
    5845
    5946    public override IEnumerable<bool> Maximization { get { return new bool[2] { true, false }; } }
     
    7158      }
    7259
    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);
    7461      QualitiesParameter.ActualValue = new DoubleArray(qualities);
    7562      return base.InstrumentedApply();
    7663    }
    7764
    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) {
    7966      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);
    8169      return new double[2] { r2, solution.IterateNodesPostfix().Sum(n => n.GetLength()) };
    8270    }
     
    8775      ApplyLinearScalingParameter.ExecutionContext = context;
    8876
    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);
    9078
    9179      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
  • branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredNumberOfVariablesEvaluator.cs

    r12147 r12848  
    2323using System.Collections.Generic;
    2424using System.Linq;
    25 using System.Security.Cryptography;
    2625using HeuristicLab.Common;
    2726using HeuristicLab.Core;
    2827using HeuristicLab.Data;
    2928using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    30 using HeuristicLab.Parameters;
    3129using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3230
     
    3533  [StorableClass]
    3634  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 
    4635    [StorableConstructor]
    4736    protected PearsonRSquaredNumberOfVariablesEvaluator(bool deserializing) : base(deserializing) { }
     
    5342    }
    5443
    55     public PearsonRSquaredNumberOfVariablesEvaluator()
    56       : base() {
    57       Parameters.Add(new FixedValueParameter<BoolValue>(useConstantOptimizationParameterName, "", new BoolValue(false)));
    58     }
     44    public PearsonRSquaredNumberOfVariablesEvaluator() : base() { }
    5945
    6046    public override IEnumerable<bool> Maximization { get { return new bool[2] { true, false }; } }
     
    7157        SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, solution, problemData, rows, applyLinearScaling, 5, estimationLimits.Upper, estimationLimits.Lower);
    7258      }
    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);
    7460      QualitiesParameter.ActualValue = new DoubleArray(qualities);
    7561      return base.InstrumentedApply();
    7662    }
    7763
    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) {
    7965      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);
    8168      return new double[2] { r2, solution.IterateNodesPostfix().OfType<VariableTreeNode>().Count() };
    8269    }
     
    8774      ApplyLinearScalingParameter.ExecutionContext = context;
    8875
    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);
    9077
    9178      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
  • branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredTreeComplexityEvaluator.cs

    r12147 r12848  
    2626using HeuristicLab.Data;
    2727using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    28 using HeuristicLab.Parameters;
    2928using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3029
     
    3332  [StorableClass]
    3433  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 
    4434    [StorableConstructor]
    4535    protected PearsonRSquaredTreeComplexityEvaluator(bool deserializing) : base(deserializing) { }
     
    5141    }
    5242
    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() { }
    6444
    6545    public override IEnumerable<bool> Maximization { get { return new bool[2] { true, false }; } }
     
    7656        SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, solution, problemData, rows, applyLinearScaling, 5, estimationLimits.Upper, estimationLimits.Lower);
    7757      }
    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);
    7959      QualitiesParameter.ActualValue = new DoubleArray(qualities);
    8060      return base.InstrumentedApply();
    8161    }
    8262
    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) {
    8464      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);
    8667      return new double[2] { r2, SymbolicDataAnalysisModelComplexityAnalyzer.CalculateComplexity(solution.Root.GetSubtree(0).GetSubtree(0)) };
    8768    }
     
    9273      ApplyLinearScalingParameter.ExecutionContext = context;
    9374
    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);
    9576
    9677      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
  • branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveEvaluator.cs

    r12130 r12848  
    2222
    2323using HeuristicLab.Common;
     24using HeuristicLab.Core;
     25using HeuristicLab.Data;
     26using HeuristicLab.Parameters;
    2427using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     28
    2529namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
     30  [StorableClass]
    2631  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
    2751    [StorableConstructor]
    2852    protected SymbolicRegressionMultiObjectiveEvaluator(bool deserializing) : base(deserializing) { }
     
    3155    }
    3256
    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    }
    3472  }
    3573}
  • branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs

    r12130 r12848  
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
    2324using HeuristicLab.Common;
     
    4748      IEnumerable<int> rows = GenerateRowsToEvaluate();
    4849      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);
    5060      QualitiesParameter.ActualValue = new DoubleArray(qualities);
    5161      return base.InstrumentedApply();
    5262    }
    5363
    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);
    5867
    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
    7071      return new double[2] { mse, solution.Length };
    7172    }
     
    7677      ApplyLinearScalingParameter.ExecutionContext = context;
    7778
    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);
    7980
    8081      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
  • branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs

    r12147 r12848  
    2626using HeuristicLab.Data;
    2727using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    28 using HeuristicLab.Parameters;
    2928using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3029
     
    3332  [StorableClass]
    3433  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 
    4434    [StorableConstructor]
    4535    protected SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator(bool deserializing) : base(deserializing) { }
     
    5141    }
    5242
    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() { }
    6444
    6545    public override IEnumerable<bool> Maximization { get { return new bool[2] { true, false }; } }
     
    7656        SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, solution, problemData, rows, applyLinearScaling, 5, estimationLimits.Upper, estimationLimits.Lower);
    7757      }
    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);
    7959      QualitiesParameter.ActualValue = new DoubleArray(qualities);
    8060      return base.InstrumentedApply();
    8161    }
    8262
    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) {
    8464      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);
    8667      return new double[2] { r2, solution.Length };
    8768    }
     
    9273      ApplyLinearScalingParameter.ExecutionContext = context;
    9374
    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);
    9576
    9677      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
Note: See TracChangeset for help on using the changeset viewer.