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.Classification/3.4/MultiObjective
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs

    r5759 r5770  
    4646    public override 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, IClassificationProblemData 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.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs

    r5759 r5770  
    2626    public override IOperation Apply() {
    2727      IEnumerable<int> rows = GenerateRowsToEvaluate();
    28       double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value, ProblemDataParameter.ActualValue, rows);
     28      double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows);
    2929      QualitiesParameter.ActualValue = new DoubleArray(qualities);
    3030      return base.Apply();
     
    4646    public override double[] Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IClassificationProblemData problemData, IEnumerable<int> rows) {
    4747      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
    48       LowerEstimationLimitParameter.ExecutionContext = context;
    49       UpperEstimationLimitParameter.ExecutionContext = context;
     48      EstimationLimitsParameter.ExecutionContext = context;
    5049
    51       double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value, problemData, rows);
     50      double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows);
    5251
    5352      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
    54       LowerEstimationLimitParameter.ExecutionContext = null;
    55       UpperEstimationLimitParameter.ExecutionContext = null;
     53      EstimationLimitsParameter.ExecutionContext = null;
    5654
    5755      return quality;
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveProblem.cs

    r5759 r5770  
    3434    private const int InitialMaximumTreeDepth = 8;
    3535    private const int InitialMaximumTreeLength = 25;
    36     private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";
    37     private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";
    38     private const string LowerEstimationLimitParameterDescription = "The lower limit for the estimated value that can be returned by the symbolic classification model.";
    39     private const string UpperEstimationLimitParameterDescription = "The upper limit for the estimated value that can be returned by the symbolic classification model.";
     36    private const string EstimationLimitsParameterName = "EstimationLimits";
     37    private const string EstimationLimitsParameterDescription = "The lower and upper limit for the estimated value that can be returned by the symbolic classification model.";
    4038
    4139    #region parameter properties
    42     public IFixedValueParameter<DoubleValue> LowerEstimationLimitParameter {
    43       get { return (IFixedValueParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
    44     }
    45     public IFixedValueParameter<DoubleValue> UpperEstimationLimitParameter {
    46       get { return (IFixedValueParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; }
     40    public IFixedValueParameter<DoubleLimit> EstimationLimitsParameter {
     41      get { return (IFixedValueParameter<DoubleLimit>)Parameters[EstimationLimitsParameterName]; }
    4742    }
    4843    #endregion
    4944    #region properties
    50     public DoubleValue LowerEstimationLimit {
    51       get { return LowerEstimationLimitParameter.Value; }
    52     }
    53     public DoubleValue UpperEstimationLimit {
    54       get { return UpperEstimationLimitParameter.Value; }
     45    public DoubleLimit EstimationLimits {
     46      get { return EstimationLimitsParameter.Value; }
    5547    }
    5648    #endregion
     
    6254    public SymbolicClassificationMultiObjectiveProblem()
    6355      : base(new ClassificationProblemData(), new SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator(), new SymbolicDataAnalysisExpressionTreeCreator()) {
    64       Parameters.Add(new FixedValueParameter<DoubleValue>(LowerEstimationLimitParameterName, LowerEstimationLimitParameterDescription, new DoubleValue()));
    65       Parameters.Add(new FixedValueParameter<DoubleValue>(UpperEstimationLimitParameterName, UpperEstimationLimitParameterDescription, new DoubleValue()));
     56      Parameters.Add(new FixedValueParameter<DoubleLimit>(EstimationLimitsParameterName, EstimationLimitsParameterDescription, new DoubleLimit()));
    6657
    6758      Maximization = new BoolArray(new bool[] { false, false });
     
    8475        var mean = targetValues.Average();
    8576        var range = targetValues.Max() - targetValues.Min();
    86         UpperEstimationLimit.Value = mean + PunishmentFactor * range;
    87         LowerEstimationLimit.Value = mean - PunishmentFactor * range;
     77        EstimationLimits.Upper = mean + PunishmentFactor * range;
     78        EstimationLimits.Lower = mean - PunishmentFactor * range;
    8879      }
    8980    }
     
    9687    protected new void ParameterizeOperators() {
    9788      base.ParameterizeOperators();
    98       var operators = Parameters.OfType<IValueParameter>().Select(p => p.Value).OfType<IOperator>().Union(Operators);
    99       foreach (var op in operators.OfType<ISymbolicDataAnalysisBoundedOperator>()) {
    100         op.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameterName;
    101         op.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameterName;
     89      if (Parameters.ContainsKey(EstimationLimitsParameterName)) {
     90        var operators = Parameters.OfType<IValueParameter>().Select(p => p.Value).OfType<IOperator>().Union(Operators);
     91        foreach (var op in operators.OfType<ISymbolicDataAnalysisBoundedOperator>()) {
     92          op.EstimationLimitsParameter.ActualName = EstimationLimitsParameterName;
     93        }
    10294      }
    10395    }
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer.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";
     41
    4642    #region parameter properties
    4743    public ILookupParameter<IClassificationProblemData> ProblemDataParameter {
     
    5147      get { return (ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>)Parameters[SymbolicDataAnalysisTreeInterpreterParameterName]; }
    5248    }
    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]; }
     49    public IValueLookupParameter<DoubleLimit> EstimationLimitsParameter {
     50      get { return (IValueLookupParameter<DoubleLimit>)Parameters[EstimationLimitsParameterName]; }
    5951    }
    6052    public IValueParameter<BoolValue> ApplyLinearScalingParameter {
     
    6254    }
    6355    #endregion
     56
    6457    #region properties
    65     public IClassificationProblemData ProblemData {
    66       get { return ProblemDataParameter.ActualValue; }
    67     }
    68     public ISymbolicDataAnalysisExpressionTreeInterpreter SymbolicDataAnalysisTreeInterpreter {
    69       get { return SymbolicDataAnalysisTreeInterpreterParameter.ActualValue; }
    70     }
    71     public DoubleValue UpperEstimationLimit {
    72       get { return UpperEstimationLimitParameter.ActualValue; }
    73     }
    74     public DoubleValue LowerEstimationLimit {
    75       get { return LowerEstimationLimitParameter.ActualValue; }
    76     }
    7758    public BoolValue ApplyLinearScaling {
    7859      get { return ApplyLinearScalingParameter.Value; }
     
    8768      Parameters.Add(new LookupParameter<IClassificationProblemData>(ProblemDataParameterName, "The problem data for the symbolic classification solution."));
    8869      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 classification model."));
    90       Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic classification model."));
     70      Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The lower and upper limit for the estimated values produced by the symbolic classification model."));
    9171      Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic classification solution should be linearly scaled.", new BoolValue(false)));
    9272    }
     
    9676
    9777    protected override ISymbolicClassificationSolution CreateSolution(ISymbolicExpressionTree bestTree, double[] bestQuality) {
    98       var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreter, LowerEstimationLimit.Value, UpperEstimationLimit.Value);
    99       var solution = new SymbolicDiscriminantFunctionClassificationSolution(model, ProblemData);
     78      var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
     79      var solution = new SymbolicDiscriminantFunctionClassificationSolution(model, ProblemDataParameter.ActualValue);
    10080      if (ApplyLinearScaling.Value) {
    10181        solution.ScaleModel();
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer.cs

    r5759 r5770  
    3535  public sealed class SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer : SymbolicDataAnalysisMultiObjectiveValidationBestSolutionAnalyzer<ISymbolicClassificationSolution, ISymbolicClassificationMultiObjectiveEvaluator, IClassificationProblemData>,
    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     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 {
     
    6157    public SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer()
    6258      : base() {
    63       Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic classification model."));
    64       Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic classification model."));
     59      Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The loewr and upper limit for the estimated values produced by the symbolic classification model."));
    6560      Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic classification solution should be linearly scaled.", new BoolValue(false)));
    6661    }
     
    7065
    7166    protected override ISymbolicClassificationSolution CreateSolution(ISymbolicExpressionTree bestTree, double[] bestQualities) {
    72       var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value);
     67      var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
    7368      var solution = new SymbolicDiscriminantFunctionClassificationSolution(model, ProblemDataParameter.ActualValue);
    7469      if (ApplyLinearScaling.Value) {
Note: See TracChangeset for help on using the changeset viewer.