Changeset 13211


Ignore:
Timestamp:
11/17/15 13:55:11 (4 years ago)
Author:
mkommend
Message:

#2175: Added parameter for constant optimization iterations.

Location:
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredNestedTreeSizeEvaluator.cs

    r12849 r13211  
    5555
    5656      if (UseConstantOptimization) {
    57         SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, solution, problemData, rows, applyLinearScaling, 5, estimationLimits.Upper, estimationLimits.Lower);
     57        SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, solution, problemData, rows, applyLinearScaling, ConstantOptimizationIterations, estimationLimits.Upper, estimationLimits.Lower);
    5858      }
    5959
  • branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredNumberOfVariablesEvaluator.cs

    r12849 r13211  
    5555
    5656      if (UseConstantOptimization) {
    57         SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, solution, problemData, rows, applyLinearScaling, 5, estimationLimits.Upper, estimationLimits.Lower);
     57        SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, solution, problemData, rows, applyLinearScaling, ConstantOptimizationIterations, estimationLimits.Upper, estimationLimits.Lower);
    5858      }
    5959      double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces);
  • branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredTreeComplexityEvaluator.cs

    r12848 r13211  
    5454
    5555      if (UseConstantOptimization) {
    56         SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, solution, problemData, rows, applyLinearScaling, 5, estimationLimits.Upper, estimationLimits.Lower);
     56        SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, solution, problemData, rows, applyLinearScaling, ConstantOptimizationIterations, estimationLimits.Upper, estimationLimits.Lower);
    5757      }
    5858      double[] qualities = Calculate(interpreter, solution, estimationLimits.Lower, estimationLimits.Upper, problemData, rows, applyLinearScaling, DecimalPlaces);
  • branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveEvaluator.cs

    r12848 r13211  
    3232    private const string DecimalPlacesParameterName = "Decimal Places";
    3333    private const string UseConstantOptimizationParameterName = "Use constant optimization";
     34    private const string ConstantOptimizationIterationsParameterName = "Constant optimization iterations";
    3435
    3536    public IFixedValueParameter<IntValue> DecimalPlacesParameter {
     
    4041    }
    4142
     43    public IFixedValueParameter<IntValue> ConstantOptimizationIterationsParameter {
     44      get { return (IFixedValueParameter<IntValue>)Parameters[ConstantOptimizationIterationsParameterName]; }
     45    }
     46
     47
    4248    public int DecimalPlaces {
    4349      get { return DecimalPlacesParameter.Value.Value; }
     
    4753      get { return UseConstantOptimizationParameter.Value.Value; }
    4854      set { UseConstantOptimizationParameter.Value.Value = value; }
     55    }
     56    public int ConstantOptimizationIterations {
     57      get { return ConstantOptimizationIterationsParameter.Value.Value; }
     58      set { ConstantOptimizationIterationsParameter.Value.Value = value; }
    4959    }
    5060
     
    5969      Parameters.Add(new FixedValueParameter<IntValue>(DecimalPlacesParameterName, "The number of decimal places used for rounding the quality values.", new IntValue(5)) { Hidden = true });
    6070      Parameters.Add(new FixedValueParameter<BoolValue>(UseConstantOptimizationParameterName, "", new BoolValue(false)));
     71      Parameters.Add(new FixedValueParameter<IntValue>(ConstantOptimizationIterationsParameterName, "The number of iterations constant optimization should be applied.", new IntValue(5)));
    6172    }
    6273
     
    6980        Parameters.Add(new FixedValueParameter<IntValue>(DecimalPlacesParameterName, "The number of decimal places used for rounding the quality values.", new IntValue(-1)) { Hidden = true });
    7081      }
     82      if (!Parameters.ContainsKey(ConstantOptimizationIterationsParameterName)) {
     83        Parameters.Add(new FixedValueParameter<IntValue>(ConstantOptimizationIterationsParameterName, "The number of iterations constant optimization should be applied.", new IntValue(5)));
     84      }
    7185    }
    7286  }
  • branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs

    r12848 r13211  
    5454
    5555      if (UseConstantOptimization) {
    56         SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, solution, problemData, rows, applyLinearScaling, 5, estimationLimits.Upper, estimationLimits.Lower);
     56        SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, solution, problemData, rows, applyLinearScaling, ConstantOptimizationIterations, estimationLimits.Upper, estimationLimits.Lower);
    5757      }
    5858
  • branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs

    r12848 r13211  
    5454
    5555      if (UseConstantOptimization) {
    56         SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, solution, problemData, rows, applyLinearScaling, 5, estimationLimits.Upper, estimationLimits.Lower);
     56        SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, solution, problemData, rows, applyLinearScaling, ConstantOptimizationIterations, estimationLimits.Upper, estimationLimits.Lower);
    5757      }
    5858      double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces);
  • branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveTrainingBestSolutionAnalyzer.cs

    r12130 r13211  
    4343    private const string EstimationLimitsParameterName = "EstimationLimits";
    4444    private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength";
     45    private const string ValidationPartitionParameterName = "ValidationPartition";
    4546
    4647    #region parameter properties
     
    5758      get { return (ILookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeLengthParameterName]; }
    5859    }
     60
     61    public IValueLookupParameter<IntRange> ValidationPartitionParameter {
     62      get { return (IValueLookupParameter<IntRange>)Parameters[ValidationPartitionParameterName]; }
     63    }
    5964    #endregion
    6065
     
    6469    public SymbolicRegressionMultiObjectiveTrainingBestSolutionAnalyzer()
    6570      : base() {
    66       Parameters.Add(new LookupParameter<IRegressionProblemData>(ProblemDataParameterName, "The problem data for the symbolic regression solution."));
    67       Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The symbolic data analysis tree interpreter for the symbolic expression tree."));
    68       Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The lower and upper limit for the estimated values produced by the symbolic regression model."));
    69       Parameters.Add(new LookupParameter<IntValue>(MaximumSymbolicExpressionTreeLengthParameterName, "Maximal length of the symbolic expression."));
     71      Parameters.Add(new LookupParameter<IRegressionProblemData>(ProblemDataParameterName, "The problem data for the symbolic regression solution.") { Hidden = true });
     72      Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The symbolic data analysis tree interpreter for the symbolic expression tree.") { Hidden = true });
     73      Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The lower and upper limit for the estimated values produced by the symbolic regression model.") { Hidden = true });
     74      Parameters.Add(new LookupParameter<IntValue>(MaximumSymbolicExpressionTreeLengthParameterName, "Maximal length of the symbolic expression.") { Hidden = true });
     75      Parameters.Add(new ValueLookupParameter<IntRange>(ValidationPartitionParameterName, "The validation partition."));
    7076    }
    7177
     
    7379    private void AfterDeserialization() {
    7480      if (!Parameters.ContainsKey(MaximumSymbolicExpressionTreeLengthParameterName))
    75         Parameters.Add(new LookupParameter<IntValue>(MaximumSymbolicExpressionTreeLengthParameterName, "Maximal length of the symbolic expression."));
     81        Parameters.Add(new LookupParameter<IntValue>(MaximumSymbolicExpressionTreeLengthParameterName, "Maximal length of the symbolic expression.") { Hidden = true });
     82      if (!Parameters.ContainsKey(ValidationPartitionParameterName))
     83        Parameters.Add(new ValueLookupParameter<IntRange>(ValidationPartitionParameterName, "The validation partition."));
    7684    }
    7785
     
    123131      }
    124132
     133
     134
    125135      qualityToTreeSize.Rows.Clear();
    126136      var trainingRow = new ScatterPlotDataRow("Training NMSE", "", sizeParetoFront.Select(x => new Point2D<double>(x.Model.SymbolicExpressionTree.Length, x.TrainingNormalizedMeanSquaredError)));
    127137      trainingRow.VisualProperties.PointSize = 5;
    128       var testRow = new ScatterPlotDataRow("Test NMSE", "", sizeParetoFront.Select(x => new Point2D<double>(x.Model.SymbolicExpressionTree.Length, x.TestNormalizedMeanSquaredError)));
    129       testRow.VisualProperties.PointSize = 5;
    130138      qualityToTreeSize.Rows.Add(trainingRow);
    131       qualityToTreeSize.Rows.Add(testRow);
     139
     140      var validationPartition = ValidationPartitionParameter.ActualValue;
     141      if (validationPartition.Size != 0) {
     142        var problemData = ProblemDataParameter.ActualValue;
     143        var validationIndizes = Enumerable.Range(validationPartition.Start, validationPartition.Size).ToList();
     144        var targetValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, validationIndizes).ToList();
     145        OnlineCalculatorError error;
     146        var validationRow = new ScatterPlotDataRow("Validation NMSE", "",
     147          sizeParetoFront.Select(x => new Point2D<double>(x.Model.SymbolicExpressionTree.Length,
     148          OnlineNormalizedMeanSquaredErrorCalculator.Calculate(targetValues, x.GetEstimatedValues(validationIndizes), out error))));
     149        validationRow.VisualProperties.PointSize = 5;
     150        qualityToTreeSize.Rows.Add(validationRow);
     151      }
    132152
    133153      double trainingArea = sizeParetoFront.Select(s => s.Model.SymbolicExpressionTree.Length * s.TrainingNormalizedMeanSquaredError).Average();
Note: See TracChangeset for help on using the changeset viewer.