Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/21/11 00:19:08 (14 years ago)
Author:
mkommend
Message:

#1418: Changed data type of estimation limits and corrected some bugs.

Location:
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs

    r5759 r5770  
    4646    public override Core.IOperation Apply() {
    4747      IEnumerable<int> rows = GenerateRowsToEvaluate();
    48       double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value, ProblemDataParameter.ActualValue, rows);
     48      double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows);
    4949      QualitiesParameter.ActualValue = new DoubleArray(qualities);
    5050      return base.Apply();
     
    6161    public override double[] Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IRegressionProblemData problemData, IEnumerable<int> rows) {
    6262      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
    63       LowerEstimationLimitParameter.ExecutionContext = context;
    64       UpperEstimationLimitParameter.ExecutionContext = context;
     63      EstimationLimitsParameter.ExecutionContext = context;
    6564
    66       double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value, problemData, rows);
     65      double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows);
    6766
    6867      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
    69       LowerEstimationLimitParameter.ExecutionContext = null;
    70       UpperEstimationLimitParameter.ExecutionContext = null;
     68      EstimationLimitsParameter.ExecutionContext = null;
    7169
    7270      return quality;
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs

    r5759 r5770  
    4747    public override IOperation Apply() {
    4848      IEnumerable<int> rows = GenerateRowsToEvaluate();
    49       double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value, ProblemDataParameter.ActualValue, rows);
     49      double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows);
    5050      QualitiesParameter.ActualValue = new DoubleArray(qualities);
    5151      return base.Apply();
     
    6767    public override double[] Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IRegressionProblemData problemData, IEnumerable<int> rows) {
    6868      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
    69       LowerEstimationLimitParameter.ExecutionContext = context;
    70       UpperEstimationLimitParameter.ExecutionContext = context;
     69      EstimationLimitsParameter.ExecutionContext = context;
    7170
    72       double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value, problemData, rows);
     71      double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows);
    7372
    7473      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
    75       LowerEstimationLimitParameter.ExecutionContext = null;
    76       UpperEstimationLimitParameter.ExecutionContext = null;
     74      EstimationLimitsParameter.ExecutionContext = null;
    7775
    7876      return quality;
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveProblem.cs

    r5759 r5770  
    3535    private const int InitialMaximumTreeDepth = 8;
    3636    private const int InitialMaximumTreeLength = 25;
    37     private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";
    38     private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";
    39     private const string LowerEstimationLimitParameterDescription = "The lower limit for the estimated value that can be returned by the symbolic regression model.";
    40     private const string UpperEstimationLimitParameterDescription = "The upper limit for the estimated value that can be returned by the symbolic regression model.";
     37    private const string EstimationLimitsParameterName = "EstimationLimits";
     38    private const string EstimationLimitsParameterDescription = "The lower and upper limit for the estimated value that can be returned by the symbolic regression model.";
    4139
    4240    #region parameter properties
    43     public IFixedValueParameter<DoubleValue> LowerEstimationLimitParameter {
    44       get { return (IFixedValueParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
    45     }
    46     public IFixedValueParameter<DoubleValue> UpperEstimationLimitParameter {
    47       get { return (IFixedValueParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; }
     41    public IFixedValueParameter<DoubleLimit> EstimationLimitsParameter {
     42      get { return (IFixedValueParameter<DoubleLimit>)Parameters[EstimationLimitsParameterName]; }
    4843    }
    4944    #endregion
     45
    5046    #region properties
    51     public DoubleValue LowerEstimationLimit {
    52       get { return LowerEstimationLimitParameter.Value; }
     47    public DoubleLimit EstimationLimits {
     48      get { return EstimationLimitsParameter.Value; }
    5349    }
    54     public DoubleValue UpperEstimationLimit {
    55       get { return UpperEstimationLimitParameter.Value; }
    56     }
     50
    5751    #endregion
     52
    5853    [StorableConstructor]
    5954    protected SymbolicRegressionMultiObjectiveProblem(bool deserializing) : base(deserializing) { }
     
    6358    public SymbolicRegressionMultiObjectiveProblem()
    6459      : base(new RegressionProblemData(), new SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator(), new SymbolicDataAnalysisExpressionTreeCreator()) {
    65       Parameters.Add(new FixedValueParameter<DoubleValue>(LowerEstimationLimitParameterName, LowerEstimationLimitParameterDescription, new DoubleValue()));
    66       Parameters.Add(new FixedValueParameter<DoubleValue>(UpperEstimationLimitParameterName, UpperEstimationLimitParameterDescription, new DoubleValue()));
     60      Parameters.Add(new FixedValueParameter<DoubleLimit>(EstimationLimitsParameterName, EstimationLimitsParameterDescription, new DoubleLimit()));
    6761
    6862      Maximization = new BoolArray(new bool[] { true, false });
     
    8579        var mean = targetValues.Average();
    8680        var range = targetValues.Max() - targetValues.Min();
    87         UpperEstimationLimit.Value = mean + PunishmentFactor * range;
    88         LowerEstimationLimit.Value = mean - PunishmentFactor * range;
     81        EstimationLimits.Upper = mean + PunishmentFactor * range;
     82        EstimationLimits.Lower = mean - PunishmentFactor * range;
    8983      }
    9084    }
     
    9791    protected override void ParameterizeOperators() {
    9892      base.ParameterizeOperators();
    99       var operators = Parameters.OfType<IValueParameter>().Select(p => p.Value).OfType<IOperator>().Union(Operators);
    100       foreach (var op in operators.OfType<ISymbolicDataAnalysisBoundedOperator>()) {
    101         op.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameterName;
    102         op.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameterName;
     93      if (Parameters.ContainsKey(EstimationLimitsParameterName)) {
     94        var operators = Parameters.OfType<IValueParameter>().Select(p => p.Value).OfType<IOperator>().Union(Operators);
     95        foreach (var op in operators.OfType<ISymbolicDataAnalysisBoundedOperator>()) {
     96          op.EstimationLimitsParameter.ActualName = EstimationLimitsParameter.Name;
     97        }
    10398      }
    10499    }
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveTrainingBestSolutionAnalyzer.cs

    r5747 r5770  
    2020#endregion
    2121
    22 using System.Collections.Generic;
    23 using System.Linq;
    2422using HeuristicLab.Common;
    2523using HeuristicLab.Core;
    2624using HeuristicLab.Data;
    2725using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    28 using HeuristicLab.Operators;
    29 using HeuristicLab.Optimization;
    3026using HeuristicLab.Parameters;
    3127using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    4137    private const string ProblemDataParameterName = "ProblemData";
    4238    private const string SymbolicDataAnalysisTreeInterpreterParameterName = "SymbolicDataAnalysisTreeInterpreter";
    43     private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";
    44     private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";
     39    private const string EstimationLimitsParameterName = "EstimationLimits";
    4540    private const string ApplyLinearScalingParameterName = "ApplyLinearScaling";
    4641    #region parameter properties
     
    5146      get { return (ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>)Parameters[SymbolicDataAnalysisTreeInterpreterParameterName]; }
    5247    }
    53     public IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter {
    54       get { return (IValueLookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; }
    55     }
    56 
    57     public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter {
    58       get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
     48    public IValueLookupParameter<DoubleLimit> EstimationLimitsParameter {
     49      get { return (IValueLookupParameter<DoubleLimit>)Parameters[EstimationLimitsParameterName]; }
    5950    }
    6051    public IValueParameter<BoolValue> ApplyLinearScalingParameter {
     
    6455
    6556    #region properties
    66     public IRegressionProblemData ProblemData {
    67       get { return ProblemDataParameter.ActualValue; }
    68     }
    69     public ISymbolicDataAnalysisExpressionTreeInterpreter SymbolicDataAnalysisTreeInterpreter {
    70       get { return SymbolicDataAnalysisTreeInterpreterParameter.ActualValue; }
    71     }
    72     public DoubleValue UpperEstimationLimit {
    73       get { return UpperEstimationLimitParameter.ActualValue; }
    74     }
    75     public DoubleValue LowerEstimationLimit {
    76       get { return LowerEstimationLimitParameter.ActualValue; }
    77     }
    7857    public BoolValue ApplyLinearScaling {
    7958      get { return ApplyLinearScalingParameter.Value; }
     
    8867      Parameters.Add(new LookupParameter<IRegressionProblemData>(ProblemDataParameterName, "The problem data for the symbolic regression solution."));
    8968      Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The symbolic data analysis tree interpreter for the symbolic expression tree."));
    90       Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic regression model."));
    91       Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic regression model."));
     69      Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The lower and upper limit for the estimated values produced by the symbolic regression model."));
    9270      Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic regression solution should be linearly scaled.", new BoolValue(true)));
    9371    }
     
    9876
    9977    protected override ISymbolicRegressionSolution CreateSolution(ISymbolicExpressionTree bestTree, double[] bestQuality) {
    100       var model = new SymbolicRegressionModel(bestTree, SymbolicDataAnalysisTreeInterpreter, LowerEstimationLimit.Value, UpperEstimationLimit.Value);
    101       var solution = new SymbolicRegressionSolution(model, ProblemData);
     78      var model = new SymbolicRegressionModel(bestTree, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
     79      var solution = new SymbolicRegressionSolution(model, ProblemDataParameter.ActualValue);
    10280      if (ApplyLinearScaling.Value)
    10381        solution.ScaleModel();
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer.cs

    r5759 r5770  
    3535  public sealed class SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer : SymbolicDataAnalysisMultiObjectiveValidationBestSolutionAnalyzer<ISymbolicRegressionSolution, ISymbolicRegressionMultiObjectiveEvaluator, IRegressionProblemData>,
    3636    ISymbolicDataAnalysisBoundedOperator {
    37     private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";
    38     private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";
     37    private const string EstimationLimitsParameterName = "EstimationLimits";
    3938    private const string ApplyLinearScalingParameterName = "ApplyLinearScaling";
    4039
    4140    #region parameter properties
    42     public IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter {
    43       get { return (IValueLookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; }
    44     }
    45 
    46     public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter {
    47       get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
     41    public IValueLookupParameter<DoubleLimit> EstimationLimitsParameter {
     42      get { return (IValueLookupParameter<DoubleLimit>)Parameters[EstimationLimitsParameterName]; }
    4843    }
    4944    public IValueParameter<BoolValue> ApplyLinearScalingParameter {
     
    6257    public SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer()
    6358      : base() {
    64       Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic regression model."));
    65       Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic regression model."));
     59      Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The lower and upper limit for the estimated values produced by the symbolic regression model."));
    6660      Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic regression solution should be linearly scaled.", new BoolValue(true)));
    6761    }
     
    7165
    7266    protected override ISymbolicRegressionSolution CreateSolution(ISymbolicExpressionTree bestTree, double[] bestQuality) {
    73       var model = new SymbolicRegressionModel(bestTree, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value);
     67      var model = new SymbolicRegressionModel(bestTree, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
    7468      var solution = new SymbolicRegressionSolution(model, ProblemDataParameter.ActualValue);
    7569      if (ApplyLinearScaling.Value)
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator.cs

    r5759 r5770  
    4646    public override IOperation Apply() {
    4747      IEnumerable<int> rows = GenerateRowsToEvaluate();
    48       double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value, ProblemDataParameter.ActualValue, rows);
     48      double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows);
    4949      Quality = new DoubleValue(quality);
    5050      return base.Apply();
     
    6060    public override double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IRegressionProblemData problemData, IEnumerable<int> rows) {
    6161      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
    62       LowerEstimationLimitParameter.ExecutionContext = context;
    63       UpperEstimationLimitParameter.ExecutionContext = context;
     62      EstimationLimitsParameter.ExecutionContext = context;
    6463
    65       double mse = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value, problemData, rows);
     64      double mse = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows);
    6665
    6766      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
    68       LowerEstimationLimitParameter.ExecutionContext = null;
    69       UpperEstimationLimitParameter.ExecutionContext = null;
     67      EstimationLimitsParameter.ExecutionContext = null;
    7068
    7169      return mse;
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.cs

    r5759 r5770  
    4747    public override IOperation Apply() {
    4848      IEnumerable<int> rows = GenerateRowsToEvaluate();
    49       double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value, ProblemDataParameter.ActualValue, rows);
     49      double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows);
    5050      Quality = new DoubleValue(quality);
    5151      return base.Apply();
     
    6666    public override double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IRegressionProblemData problemData, IEnumerable<int> rows) {
    6767      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
    68       LowerEstimationLimitParameter.ExecutionContext = context;
    69       UpperEstimationLimitParameter.ExecutionContext = context;
     68      EstimationLimitsParameter.ExecutionContext = context;
    7069
    71       double r2 = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value, problemData, rows);
     70      double r2 = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows);
    7271
    7372      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
    74       LowerEstimationLimitParameter.ExecutionContext = null;
    75       UpperEstimationLimitParameter.ExecutionContext = null;
     73      EstimationLimitsParameter.ExecutionContext = null;
    7674
    7775      return r2;
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveProblem.cs

    r5759 r5770  
    2323using HeuristicLab.Common;
    2424using HeuristicLab.Core;
    25 using HeuristicLab.Data;
    2625using HeuristicLab.Parameters;
    2726using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    3534    private const int InitialMaximumTreeDepth = 8;
    3635    private const int InitialMaximumTreeLength = 25;
    37     private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";
    38     private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";
    39     private const string LowerEstimationLimitParameterDescription = "The lower limit for the estimated value that can be returned by the symbolic regression model.";
    40     private const string UpperEstimationLimitParameterDescription = "The upper limit for the estimated value that can be returned by the symbolic regression model.";
     36    private const string EstimationLimitsParameterName = "EstimationLimits";
     37    private const string EstimationLimitsParameterDescription = "The limits for the estimated value that can be returned by the symbolic regression model.";
    4138
    4239    #region parameter properties
    43     public IFixedValueParameter<DoubleValue> LowerEstimationLimitParameter {
    44       get { return (IFixedValueParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
    45     }
    46     public IFixedValueParameter<DoubleValue> UpperEstimationLimitParameter {
    47       get { return (IFixedValueParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; }
     40    public IFixedValueParameter<DoubleLimit> EstimationLimitsParameter {
     41      get { return (IFixedValueParameter<DoubleLimit>)Parameters[EstimationLimitsParameterName]; }
    4842    }
    4943    #endregion
    5044    #region properties
    51     public DoubleValue LowerEstimationLimit {
    52       get { return LowerEstimationLimitParameter.Value; }
    53     }
    54     public DoubleValue UpperEstimationLimit {
    55       get { return UpperEstimationLimitParameter.Value; }
     45    public DoubleLimit EstimationLimits {
     46      get { return EstimationLimitsParameter.Value; }
    5647    }
    5748    #endregion
     
    6354    public SymbolicRegressionSingleObjectiveProblem()
    6455      : base(new RegressionProblemData(), new SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator(), new SymbolicDataAnalysisExpressionTreeCreator()) {
    65       Parameters.Add(new FixedValueParameter<DoubleValue>(LowerEstimationLimitParameterName, LowerEstimationLimitParameterDescription, new DoubleValue()));
    66       Parameters.Add(new FixedValueParameter<DoubleValue>(UpperEstimationLimitParameterName, UpperEstimationLimitParameterDescription, new DoubleValue()));
     56      Parameters.Add(new FixedValueParameter<DoubleLimit>(EstimationLimitsParameterName, EstimationLimitsParameterDescription, new DoubleLimit()));
    6757
    6858      Maximization.Value = true;
     
    8676        var mean = targetValues.Average();
    8777        var range = targetValues.Max() - targetValues.Min();
    88         UpperEstimationLimit.Value = mean + PunishmentFactor * range;
    89         LowerEstimationLimit.Value = mean - PunishmentFactor * range;
     78        EstimationLimits.Upper = mean + PunishmentFactor * range;
     79        EstimationLimits.Lower = mean - PunishmentFactor * range;
    9080      }
    9181    }
     
    9888    protected override void ParameterizeOperators() {
    9989      base.ParameterizeOperators();
    100       var operators = Parameters.OfType<IValueParameter>().Select(p => p.Value).OfType<IOperator>().Union(Operators);
    101       foreach (var op in operators.OfType<ISymbolicDataAnalysisBoundedOperator>()) {
    102         op.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameterName;
    103         op.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameterName;
     90      if (Parameters.ContainsKey(EstimationLimitsParameterName)) {
     91        var operators = Parameters.OfType<IValueParameter>().Select(p => p.Value).OfType<IOperator>().Union(Operators);
     92        foreach (var op in operators.OfType<ISymbolicDataAnalysisBoundedOperator>()) {
     93          op.EstimationLimitsParameter.ActualName = EstimationLimitsParameter.Name;
     94        }
    10495      }
    10596    }
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveTrainingBestSolutionAnalyzer.cs

    r5747 r5770  
    2020#endregion
    2121
    22 using System.Collections.Generic;
    23 using System.Linq;
    2422using HeuristicLab.Common;
    2523using HeuristicLab.Core;
    2624using HeuristicLab.Data;
    2725using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    28 using HeuristicLab.Operators;
    29 using HeuristicLab.Optimization;
    3026using HeuristicLab.Parameters;
    3127using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    4137    private const string ProblemDataParameterName = "ProblemData";
    4238    private const string SymbolicDataAnalysisTreeInterpreterParameterName = "SymbolicDataAnalysisTreeInterpreter";
    43     private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";
    44     private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";
     39    private const string EstimationLimitsParameterName = "EstimationLimits";
    4540    private const string ApplyLinearScalingParameterName = "ApplyLinearScaling";
    4641    #region parameter properties
     
    5146      get { return (ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>)Parameters[SymbolicDataAnalysisTreeInterpreterParameterName]; }
    5247    }
    53     public IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter {
    54       get { return (IValueLookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; }
    55     }
    56 
    57     public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter {
    58       get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
     48    public IValueLookupParameter<DoubleLimit> EstimationLimitsParameter {
     49      get { return (IValueLookupParameter<DoubleLimit>)Parameters[EstimationLimitsParameterName]; }
    5950    }
    6051    public IValueParameter<BoolValue> ApplyLinearScalingParameter {
     
    6455
    6556    #region properties
    66     public IRegressionProblemData ProblemData {
    67       get { return ProblemDataParameter.ActualValue; }
    68     }
    69     public ISymbolicDataAnalysisExpressionTreeInterpreter SymbolicDataAnalysisTreeInterpreter {
    70       get { return SymbolicDataAnalysisTreeInterpreterParameter.ActualValue; }
    71     }
    72     public DoubleValue UpperEstimationLimit {
    73       get { return UpperEstimationLimitParameter.ActualValue; }
    74     }
    75     public DoubleValue LowerEstimationLimit {
    76       get { return LowerEstimationLimitParameter.ActualValue; }
    77     }
    7857    public BoolValue ApplyLinearScaling {
    7958      get { return ApplyLinearScalingParameter.Value; }
    8059    }
    8160    #endregion
     61
    8262    [StorableConstructor]
    8363    private SymbolicRegressionSingleObjectiveTrainingBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
     
    8767      Parameters.Add(new LookupParameter<IRegressionProblemData>(ProblemDataParameterName, "The problem data for the symbolic regression solution."));
    8868      Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The symbolic data analysis tree interpreter for the symbolic expression tree."));
    89       Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic regression model."));
    90       Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic regression model."));
     69      Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The lower and upper limit for the estimated values produced by the symbolic regression model."));
    9170      Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic regression solution should be linearly scaled.", new BoolValue(true)));
    9271    }
     
    9675
    9776    protected override ISymbolicRegressionSolution CreateSolution(ISymbolicExpressionTree bestTree, double bestQuality) {
    98       var model = new SymbolicRegressionModel(bestTree, SymbolicDataAnalysisTreeInterpreter, LowerEstimationLimit.Value, UpperEstimationLimit.Value);
    99       var solution = new SymbolicRegressionSolution(model, ProblemData);
     77      var model = new SymbolicRegressionModel(bestTree, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
     78      var solution = new SymbolicRegressionSolution(model, ProblemDataParameter.ActualValue);
    10079      if (ApplyLinearScaling.Value)
    10180        solution.ScaleModel();
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer.cs

    r5759 r5770  
    3535  public sealed class SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer<ISymbolicRegressionSolution, ISymbolicRegressionSingleObjectiveEvaluator, IRegressionProblemData>,
    3636    ISymbolicDataAnalysisBoundedOperator {
    37     private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";
    38     private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";
     37    private const string EstimationLimitsParameterName = "EstimationLimits";
    3938    private const string ApplyLinearScalingParameterName = "ApplyLinearScaling";
     39
    4040    #region parameter properties
    41     public IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter {
    42       get { return (IValueLookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; }
    43     }
    44 
    45     public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter {
    46       get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
     41    public IValueLookupParameter<DoubleLimit> EstimationLimitsParameter {
     42      get { return (IValueLookupParameter<DoubleLimit>)Parameters[EstimationLimitsParameterName]; }
    4743    }
    4844    public IValueParameter<BoolValue> ApplyLinearScalingParameter {
     
    6258    public SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer()
    6359      : base() {
    64       Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic regression model."));
    65       Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic regression model."));
     60      Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The lower and upper limit for the estimated values produced by the symbolic regression model."));
    6661      Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic regression solution should be linearly scaled.", new BoolValue(true)));
    6762    }
     
    7267
    7368    protected override ISymbolicRegressionSolution CreateSolution(ISymbolicExpressionTree bestTree, double bestQuality) {
    74       var model = new SymbolicRegressionModel(bestTree, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value);
     69      var model = new SymbolicRegressionModel(bestTree, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
    7570      var solution = new SymbolicRegressionSolution(model, ProblemDataParameter.ActualValue);
    7671      if (ApplyLinearScaling.Value)
Note: See TracChangeset for help on using the changeset viewer.