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/MultiObjective
Files:
5 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)
Note: See TracChangeset for help on using the changeset viewer.