Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5722


Ignore:
Timestamp:
03/16/11 19:29:57 (14 years ago)
Author:
gkronber
Message:

#1418 fixed evaluator call from validation analyzers, fixed bugs in interactive simplifier view and added apply linear scaling flag to analyzers.

Location:
branches/DataAnalysis Refactoring
Files:
1 added
27 edited
1 copied

Legend:

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

    r5624 r5722  
    6060
    6161    public override double[] Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IClassificationProblemData problemData, IEnumerable<int> rows) {
    62       return Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows);
     62      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
     63      LowerEstimationLimitParameter.ExecutionContext = context;
     64      UpperEstimationLimitParameter.ExecutionContext = context;
     65
     66      double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows);
     67
     68      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
     69      LowerEstimationLimitParameter.ExecutionContext = null;
     70      UpperEstimationLimitParameter.ExecutionContext = null;
     71
     72      return quality;
    6373    }
    6474  }
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs

    r5624 r5722  
    3838
    3939    public override double[] Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IClassificationProblemData problemData, IEnumerable<int> rows) {
    40       return Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows);
     40      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
     41      LowerEstimationLimitParameter.ExecutionContext = context;
     42      UpperEstimationLimitParameter.ExecutionContext = context;
     43
     44      double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows);
     45
     46      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
     47      LowerEstimationLimitParameter.ExecutionContext = null;
     48      UpperEstimationLimitParameter.ExecutionContext = null;
     49
     50      return quality;
    4151    }
    4252  }
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveProblem.cs

    r5720 r5722  
    7171      InitializeOperators();
    7272      UpdateEstimationLimits();
     73      UpdateDatasetPartitions();
    7374    }
    7475
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer.cs

    r5720 r5722  
    4343    private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";
    4444    private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";
     45    private const string ApplyLinearScalingParameterName = "ApplyLinearScaling";
    4546    #region parameter properties
    4647    public ILookupParameter<IClassificationProblemData> ProblemDataParameter {
     
    5657    public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter {
    5758      get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
     59    }
     60    public IValueParameter<BoolValue> ApplyLinearScalingParameter {
     61      get { return (IValueParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; }
    5862    }
    5963    #endregion
     
    7175      get { return LowerEstimationLimitParameter.ActualValue; }
    7276    }
     77    public BoolValue ApplyLinearScaling {
     78      get { return ApplyLinearScalingParameter.Value; }
     79    }
    7380    #endregion
    7481
     
    8289      Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic classification model."));
    8390      Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic classification model."));
     91      Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic classification solution should be linearly scaled.", new BoolValue(false)));
    8492    }
    8593    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer.cs

    r5720 r5722  
    4141    private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";
    4242    private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";
     43    private const string ApplyLinearScalingParameterName = "ApplyLinearScaling";
    4344
    4445    #region parameter properties
     
    4950    public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter {
    5051      get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
     52    }
     53    public IValueParameter<BoolValue> ApplyLinearScalingParameter {
     54      get { return (IValueParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; }
    5155    }
    5256    #endregion
     
    5963      get { return LowerEstimationLimitParameter.ActualValue; }
    6064    }
     65    public BoolValue ApplyLinearScaling {
     66      get { return ApplyLinearScalingParameter.Value; }
     67    }
    6168    #endregion
    6269    [StorableConstructor]
     
    6774      Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic classification model."));
    6875      Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic classification model."));
     76      Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic classification solution should be linearly scaled.", new BoolValue(false)));
    6977    }
    7078    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator.cs

    r5624 r5722  
    5959
    6060    public override double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IClassificationProblemData problemData, IEnumerable<int> rows) {
    61       return Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows);
     61      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
     62      LowerEstimationLimitParameter.ExecutionContext = context;
     63      UpperEstimationLimitParameter.ExecutionContext = context;
     64     
     65      double mse = Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows);
     66
     67      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
     68      LowerEstimationLimitParameter.ExecutionContext = null;
     69      UpperEstimationLimitParameter.ExecutionContext = null;
     70
     71      return mse;
    6272    }
    6373  }
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator.cs

    r5624 r5722  
    5858
    5959    public override double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IClassificationProblemData problemData, IEnumerable<int> rows) {
    60       return Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows);
     60      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
     61      LowerEstimationLimitParameter.ExecutionContext = context;
     62      UpperEstimationLimitParameter.ExecutionContext = context;
     63
     64      double r2 = Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows);
     65
     66      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
     67      LowerEstimationLimitParameter.ExecutionContext = null;
     68      UpperEstimationLimitParameter.ExecutionContext = null;
     69
     70      return r2;
    6171    }
    6272  }
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveProblem.cs

    r5720 r5722  
    7070      InitializeOperators();
    7171      UpdateEstimationLimits();
     72      UpdateDatasetPartitions();
    7273    }
    7374
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer.cs

    r5720 r5722  
    4343    private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";
    4444    private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";
     45    private const string ApplyLinearScalingParameterName = "ApplyLinearScaling";
    4546    #region parameter properties
    4647    public ILookupParameter<IClassificationProblemData> ProblemDataParameter {
     
    5657    public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter {
    5758      get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
     59    }
     60    public IValueParameter<BoolValue> ApplyLinearScalingParameter {
     61      get { return (IValueParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; }
    5862    }
    5963    #endregion
     
    7175      get { return LowerEstimationLimitParameter.ActualValue; }
    7276    }
     77    public BoolValue ApplyLinearScaling {
     78      get { return ApplyLinearScalingParameter.Value; }
     79    }
    7380    #endregion
    7481
     
    8289      Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic classification model."));
    8390      Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic classification model."));
     91      Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic classification solution should be linearly scaled.", new BoolValue(false)));
    8492    }
    8593    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer.cs

    r5720 r5722  
    4141    private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";
    4242    private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";
     43    private const string ApplyLinearScalingParameterName = "ApplyLinearScaling";
    4344
    4445    #region parameter properties
     
    4950    public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter {
    5051      get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
     52    }
     53
     54    public IValueParameter<BoolValue> ApplyLinearScalingParameter {
     55      get { return (IValueParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; }
    5156    }
    5257    #endregion
     
    5964      get { return LowerEstimationLimitParameter.ActualValue; }
    6065    }
     66    public BoolValue ApplyLinearScaling {
     67      get { return ApplyLinearScalingParameter.Value; }
     68    }
    6169    #endregion
    6270    [StorableConstructor]
     
    6775      Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic classification model."));
    6876      Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic classification model."));
     77      Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic classification solution should be linearly scaled.", new BoolValue(false)));
    6978    }
    7079    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.csproj

    r5685 r5722  
    129129    <Compile Include="SingleObjective\SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.cs" />
    130130    <Compile Include="SymbolicRegressionSolution.cs" />
     131    <Compile Include="SymbolicRegressionSolutionLinearScaler.cs" />
    131132    <None Include="HeuristicLab.snk" />
    132133    <None Include="HeuristicLabProblemsDataAnalysisSymbolicRegressionPlugin.cs.frame" />
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs

    r5624 r5722  
    6060
    6161    public override double[] Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IRegressionProblemData problemData, IEnumerable<int> rows) {
    62       return Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows);
     62      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
     63      LowerEstimationLimitParameter.ExecutionContext = context;
     64      UpperEstimationLimitParameter.ExecutionContext = context;
     65
     66      double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows);
     67
     68      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
     69      LowerEstimationLimitParameter.ExecutionContext = null;
     70      UpperEstimationLimitParameter.ExecutionContext = null;
     71
     72      return quality;
    6373    }
    6474  }
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs

    r5624 r5722  
    5959
    6060    public override double[] Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IRegressionProblemData problemData, IEnumerable<int> rows) {
    61       return Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows);
     61      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
     62      LowerEstimationLimitParameter.ExecutionContext = context;
     63      UpperEstimationLimitParameter.ExecutionContext = context;
     64
     65      double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows);
     66
     67      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
     68      LowerEstimationLimitParameter.ExecutionContext = null;
     69      UpperEstimationLimitParameter.ExecutionContext = null;
     70
     71      return quality;
    6272    }
    6373  }
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveProblem.cs

    r5720 r5722  
    7272      InitializeOperators();
    7373      UpdateEstimationLimits();
     74      UpdateDatasetPartitions();
    7475    }
    7576
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveTrainingBestSolutionAnalyzer.cs

    r5720 r5722  
    4343    private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";
    4444    private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";
     45    private const string ApplyLinearScalingParameterName = "ApplyLinearScaling";
    4546    #region parameter properties
    4647    public ILookupParameter<IRegressionProblemData> ProblemDataParameter {
     
    5657    public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter {
    5758      get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
     59    }
     60    public IValueParameter<BoolValue> ApplyLinearScalingParameter {
     61      get { return (IValueParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; }
    5862    }
    5963    #endregion
     
    7276      get { return LowerEstimationLimitParameter.ActualValue; }
    7377    }
     78    public BoolValue ApplyLinearScaling {
     79      get { return ApplyLinearScalingParameter.Value; }
     80    }
    7481    #endregion
    7582
     
    8390      Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic regression model."));
    8491      Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic regression model."));
     92      Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic regression solution should be linearly scaled.", new BoolValue(false)));
    8593    }
    8694
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer.cs

    r5720 r5722  
    4141    private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";
    4242    private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";
     43    private const string ApplyLinearScalingParameterName = "ApplyLinearScaling";
    4344
    4445    #region parameter properties
     
    4950    public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter {
    5051      get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
     52    }
     53        public IValueParameter<BoolValue> ApplyLinearScalingParameter {
     54      get { return (IValueParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; }
    5155    }
    5256    #endregion
     
    5963      get { return LowerEstimationLimitParameter.ActualValue; }
    6064    }
     65    public BoolValue ApplyLinearScaling {
     66      get { return ApplyLinearScalingParameter.Value; }
     67    }
    6168    #endregion
    6269    [StorableConstructor]
     
    6774      Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic regression model."));
    6875      Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic regression model."));
     76      Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic regression solution should be linearly scaled.", new BoolValue(false)));
    6977    }
    7078    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator.cs

    r5624 r5722  
    5959
    6060    public override double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IRegressionProblemData problemData, IEnumerable<int> rows) {
    61       return Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows);
     61      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
     62      LowerEstimationLimitParameter.ExecutionContext = context;
     63      UpperEstimationLimitParameter.ExecutionContext = context;
     64
     65      double mse = Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows);
     66
     67      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
     68      LowerEstimationLimitParameter.ExecutionContext = null;
     69      UpperEstimationLimitParameter.ExecutionContext = null;
     70
     71      return mse;
    6272    }
    6373  }
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.cs

    r5624 r5722  
    5959
    6060    public override double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IRegressionProblemData problemData, IEnumerable<int> rows) {
    61       return Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows);
     61      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
     62      LowerEstimationLimitParameter.ExecutionContext = context;
     63      UpperEstimationLimitParameter.ExecutionContext = context;
     64
     65      double r2 = Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows);
     66
     67      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
     68      LowerEstimationLimitParameter.ExecutionContext = null;
     69      UpperEstimationLimitParameter.ExecutionContext = null;
     70
     71      return r2;
    6272    }
    6373  }
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveProblem.cs

    r5720 r5722  
    7272      InitializeOperators();
    7373      UpdateEstimationLimits();
     74      UpdateDatasetPartitions();
    7475    }
    7576
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveTrainingBestSolutionAnalyzer.cs

    r5720 r5722  
    4343    private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";
    4444    private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";
     45    private const string ApplyLinearScalingParameterName = "ApplyLinearScaling";
    4546    #region parameter properties
    4647    public ILookupParameter<IRegressionProblemData> ProblemDataParameter {
     
    5657    public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter {
    5758      get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
     59    }
     60    public IValueParameter<BoolValue> ApplyLinearScalingParameter {
     61      get { return (IValueParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; }
    5862    }
    5963    #endregion
     
    7276      get { return LowerEstimationLimitParameter.ActualValue; }
    7377    }
     78    public BoolValue ApplyLinearScaling {
     79      get { return ApplyLinearScalingParameter.Value; }
     80    }
    7481    #endregion
    7582    [StorableConstructor]
     
    8289      Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic regression model."));
    8390      Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic regression model."));
     91      Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic regression solution should be linearly scaled.", new BoolValue(false)));
    8492    }
    8593    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer.cs

    r5720 r5722  
    4141    private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";
    4242    private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";
    43 
     43    private const string ApplyLinearScalingParameterName = "ApplyLinearScaling";
    4444    #region parameter properties
    4545    public IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter {
     
    5959      get { return LowerEstimationLimitParameter.ActualValue; }
    6060    }
     61    public IValueParameter<BoolValue> ApplyLinearScalingParameter {
     62      get { return (IValueParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; }
     63    }
     64    public BoolValue ApplyLinearScaling {
     65      get { return ApplyLinearScalingParameter.Value; }
     66    }
    6167    #endregion
    6268
     
    6874      Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic regression model."));
    6975      Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic regression model."));
     76      Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic regression solution should be linearly scaled.", new BoolValue(false)));
    7077    }
    7178
     
    7683    protected override ISymbolicRegressionSolution CreateSolution(ISymbolicExpressionTree bestTree, double bestQuality) {
    7784      var model = new SymbolicRegressionModel(bestTree, SymbolicDataAnalysisTreeInterpreter, LowerEstimationLimit.Value, UpperEstimationLimit.Value);
    78       return new SymbolicRegressionSolution(model, ProblemData);
     85      var solution = new SymbolicRegressionSolution(model, ProblemData);
     86      if (ApplyLinearScaling.Value)
     87        SymbolicRegressionSolutionLinearScaler.Scale(solution);
     88      return solution;
    7989    }
    8090  }
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolutionLinearScaler.cs

    r5720 r5722  
    2727using HeuristicLab.Parameters;
    2828using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    29 using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols;
     29using HeuristicLab.Problems.DataAnalysis.Symbolic;
    3030
    31 namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Analyzers {
     31namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
    3232  /// <summary>
    3333  /// An operator that creates a linearly transformed symbolic regression solution (given alpha and beta).
     
    7070
    7171    public override IOperation Apply() {
    72       SymbolicExpressionTree tree = SymbolicExpressionTreeParameter.ActualValue;
    73       DoubleValue alpha = AlphaParameter.ActualValue;
    74       DoubleValue beta = BetaParameter.ActualValue;
    75       if (alpha != null && beta != null) {
    76         ScaledSymbolicExpressionTreeParameter.ActualValue = Scale(tree, alpha.Value, beta.Value);
    77       } else {
    78         // alpha or beta parameter not available => do not scale tree
    79         ScaledSymbolicExpressionTreeParameter.ActualValue = tree;
    80       }
    81 
     72      // TODO
    8273      return base.Apply();
    8374    }
    8475
    85     public static SymbolicExpressionTree Scale(SymbolicExpressionTree original, double alpha, double beta) {
    86       var mainBranch = original.Root.SubTrees[0].SubTrees[0];
     76    private static ISymbolicExpressionTree Scale(ISymbolicExpressionTree original, double alpha, double beta) {
     77      var mainBranch = original.Root.GetSubTree(0).GetSubTree(0);
    8778      var scaledMainBranch = MakeSum(MakeProduct(beta, mainBranch), alpha);
    8879
    8980      // remove the main branch before cloning to prevent cloning of sub-trees
    90       original.Root.SubTrees[0].RemoveSubTree(0);
     81      original.Root.GetSubTree(0).RemoveSubTree(0);
    9182      var scaledTree = (SymbolicExpressionTree)original.Clone();
    9283      // insert main branch into the original tree again
    93       original.Root.SubTrees[0].InsertSubTree(0, mainBranch);
     84      original.Root.GetSubTree(0).InsertSubTree(0, mainBranch);
    9485      // insert the scaled main branch into the cloned tree
    95       scaledTree.Root.SubTrees[0].InsertSubTree(0, scaledMainBranch);
     86      scaledTree.Root.GetSubTree(0).InsertSubTree(0, scaledMainBranch);
    9687      return scaledTree;
    9788    }
    9889
    99     private static SymbolicExpressionTreeNode MakeSum(SymbolicExpressionTreeNode treeNode, double alpha) {
     90    private static ISymbolicExpressionTreeNode MakeSum(ISymbolicExpressionTreeNode treeNode, double alpha) {
    10091      var node = (new Addition()).CreateTreeNode();
    10192      var alphaConst = MakeConstant(alpha);
     
    10596    }
    10697
    107     private static SymbolicExpressionTreeNode MakeProduct(double beta, SymbolicExpressionTreeNode treeNode) {
     98    private static ISymbolicExpressionTreeNode MakeProduct(double beta, ISymbolicExpressionTreeNode treeNode) {
    10899      var node = (new Multiplication()).CreateTreeNode();
    109100      var betaConst = MakeConstant(beta);
     
    113104    }
    114105
    115     private static SymbolicExpressionTreeNode MakeConstant(double c) {
     106    private static ISymbolicExpressionTreeNode MakeConstant(double c) {
    116107      var node = (ConstantTreeNode)(new Constant()).CreateTreeNode();
    117108      node.Value = c;
    118109      return node;
    119110    }
     111
     112    internal static void Scale(SymbolicRegressionSolution solution) {
     113      var dataset = solution.ProblemData.Dataset;
     114      var targetVariable = solution.ProblemData.TargetVariable;
     115      var rows = solution.ProblemData.TrainingIndizes;
     116      var estimatedValues = solution.GetEstimatedValues(rows);
     117      var targetValues = dataset.GetEnumeratedVariableValues(targetVariable, rows);
     118      double alpha;
     119      double beta;
     120      OnlineLinearScalingParameterCalculator.Calculate(estimatedValues, targetValues, out alpha, out beta);
     121
     122      var originalModel = solution.Model;
     123      solution.Model = new SymbolicRegressionModel(Scale(originalModel.SymbolicExpressionTree, alpha, beta), originalModel.Interpreter);
     124    }
    120125  }
    121126}
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs

    r5717 r5722  
    3333namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
    3434  public abstract partial class InteractiveSymbolicDataAnalysisSolutionSimplifierView : AsynchronousContentView {
    35     private ISymbolicExpressionTree simplifiedExpressionTree;
    3635    private Dictionary<ISymbolicExpressionTreeNode, ConstantTreeNode> replacementNodes;
    3736    private Dictionary<ISymbolicExpressionTreeNode, double> nodeImpacts;
     
    4140      this.replacementNodes = new Dictionary<ISymbolicExpressionTreeNode, ConstantTreeNode>();
    4241      this.nodeImpacts = new Dictionary<ISymbolicExpressionTreeNode, double>();
    43       this.simplifiedExpressionTree = null;
    4442      this.Caption = "Interactive Solution Simplifier";
    4543    }
     
    8583      replacementNodes.Clear();
    8684      if (Content != null && Content.Model != null && Content.ProblemData != null) {
    87         SymbolicDataAnalysisExpressionTreeSimplifier simplifier = new SymbolicDataAnalysisExpressionTreeSimplifier();
    88         simplifiedExpressionTree = simplifier.Simplify(Content.Model.SymbolicExpressionTree);
    89 
    90         var replacementValues = CalculateReplacementValues(simplifiedExpressionTree);
     85        var tree = Content.Model.SymbolicExpressionTree;
     86        var replacementValues = CalculateReplacementValues(tree);
    9187        foreach (var pair in replacementValues) {
    9288          replacementNodes.Add(pair.Key, MakeConstantTreeNode(pair.Value));
    9389        }
    94         nodeImpacts = CalculateImpactValues(simplifiedExpressionTree);
     90        nodeImpacts = CalculateImpactValues(Content.Model.SymbolicExpressionTree);
    9591
    9692        // automatically fold all branches with impact = 1
    97         List<ISymbolicExpressionTreeNode> nodeList = simplifiedExpressionTree.Root.GetSubTree(0).IterateNodesPrefix().ToList();
     93        List<ISymbolicExpressionTreeNode> nodeList = Content.Model.SymbolicExpressionTree.Root.GetSubTree(0).IterateNodesPrefix().ToList();
    9894        foreach (var parent in nodeList) {
    9995          for (int subTreeIndex = 0; subTreeIndex < parent.SubTrees.Count(); subTreeIndex++) {
     
    105101        }
    106102        // show only interesting part of solution
    107         this.treeChart.Tree = new SymbolicExpressionTree(simplifiedExpressionTree.Root.GetSubTree(0).GetSubTree(0));
     103        this.treeChart.Tree = new SymbolicExpressionTree(tree.Root.GetSubTree(0).GetSubTree(0));
    108104        this.PaintNodeImpacts();
    109105      }
     
    125121    private void treeChart_SymbolicExpressionTreeNodeDoubleClicked(object sender, MouseEventArgs e) {
    126122      VisualSymbolicExpressionTreeNode visualTreeNode = (VisualSymbolicExpressionTreeNode)sender;
    127       foreach (SymbolicExpressionTreeNode treeNode in simplifiedExpressionTree.IterateNodesPostfix()) {
     123      var tree = Content.Model.SymbolicExpressionTree;
     124      foreach (SymbolicExpressionTreeNode treeNode in tree.IterateNodesPostfix()) {
    128125        for (int i = 0; i < treeNode.SubTrees.Count(); i++) {
    129126          ISymbolicExpressionTreeNode subTree = treeNode.GetSubTree(i);
     
    135132
    136133      // show only interesting part of solution
    137       this.treeChart.Tree = new SymbolicExpressionTree(simplifiedExpressionTree.Root.GetSubTree(0).GetSubTree(0));
     134      this.treeChart.Tree = new SymbolicExpressionTree(tree.Root.GetSubTree(0).GetSubTree(0));
    138135
    139       SymbolicExpressionTree tree = (SymbolicExpressionTree)simplifiedExpressionTree.Clone();
    140136      UpdateModel(tree);
    141137      this.PaintNodeImpacts();
     
    157153      double max = impacts.Max();
    158154      double min = impacts.Min();
    159       foreach (ISymbolicExpressionTreeNode treeNode in simplifiedExpressionTree.IterateNodesPostfix()) {
     155      foreach (ISymbolicExpressionTreeNode treeNode in Content.Model.SymbolicExpressionTree.IterateNodesPostfix()) {
    160156        if (!(treeNode is ConstantTreeNode) && nodeImpacts.ContainsKey(treeNode)) {
    161157          double impact = this.nodeImpacts[treeNode];
    162158          double replacementValue = this.replacementNodes[treeNode].Value;
    163159          VisualSymbolicExpressionTreeNode visualTree = treeChart.GetVisualSymbolicExpressionTreeNode(treeNode);
    164          
     160
    165161          // impact = 0 if no change
    166162          // impact < 0 if new solution is better
     
    180176
    181177    private void PaintCollapsedNodes() {
    182       foreach (ISymbolicExpressionTreeNode treeNode in simplifiedExpressionTree.IterateNodesPostfix()) {
     178      foreach (ISymbolicExpressionTreeNode treeNode in Content.Model.SymbolicExpressionTree.IterateNodesPostfix()) {
    183179        if (treeNode is ConstantTreeNode && replacementNodes.ContainsValue((ConstantTreeNode)treeNode))
    184180          this.treeChart.GetVisualSymbolicExpressionTreeNode(treeNode).LineColor = Color.DarkOrange;
     
    192188
    193189    private void btnSimplify_Click(object sender, EventArgs e) {
    194       this.CalculateReplacementNodesAndNodeImpacts();
     190      SymbolicDataAnalysisExpressionTreeSimplifier simplifier = new SymbolicDataAnalysisExpressionTreeSimplifier();
     191      var simplifiedExpressionTree = simplifier.Simplify(Content.Model.SymbolicExpressionTree);
     192      UpdateModel(simplifiedExpressionTree);
    195193    }
    196194  }
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisMultiObjectiveValidationBestSolutionAnalyzer.cs

    r5685 r5722  
    115115      int end = ValidationSamplesEnd.Value;
    116116      IEnumerable<int> rows = Enumerable.Range(start, end - start);
     117      IExecutionContext childContext = (IExecutionContext)ExecutionContext.CreateChildOperation(evaluator);
    117118      for (int i = 0; i < tree.Length; i++) {
    118         qualities.Add(evaluator.Evaluate(ExecutionContext, tree[i], ProblemData, rows)); // qualities[i] = ...
     119        qualities.Add(evaluator.Evaluate(childContext, tree[i], ProblemData, rows)); // qualities[i] = ...
    119120        if (IsNonDominated(qualities[i], trainingBestQualities, maximization) &&
    120121          IsNonDominated(qualities[i], qualities, maximization)) {
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer.cs

    r5613 r5722  
    8787      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>(QualityParameterName, "The qualities of the trees that should be analyzed."));
    8888      Parameters.Add(new LookupParameter<BoolValue>(MaximizationParameterName, "The direction of optimization."));
    89       Parameters.Add(new LookupParameter<T>(ValidationBestSolutionParameterName, "The validation best symbolic data analyis solution."));
     89      Parameters.Add(new LookupParameter<S>(ValidationBestSolutionParameterName, "The validation best symbolic data analyis solution."));
    9090      Parameters.Add(new LookupParameter<DoubleValue>(ValidationBestSolutionQualityParameterName, "The quality of the validation best symbolic data analysis solution."));
    9191    }
     
    101101      int end = ValidationSamplesEnd.Value;
    102102      IEnumerable<int> rows = Enumerable.Range(start, end - start);
     103      IExecutionContext childContext = (IExecutionContext)ExecutionContext.CreateChildOperation(evaluator);
    103104      for (int i = 0; i < tree.Length; i++) {
    104         quality[i] = evaluator.Evaluate(ExecutionContext, tree[i], ProblemData, rows);
     105        quality[i] = evaluator.Evaluate(childContext, tree[i], ProblemData, rows);
    105106        if (IsBetter(quality[i], bestQuality, Maximization.Value)) {
    106107          bestQuality = quality[i];
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisValidationAnalyzer.cs

    r5607 r5722  
    2222using HeuristicLab.Data;
    2323namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    24   public interface ISymbolicDataAnalysisValidationAnalyzer<T, U> : ISymbolicDataAnalysisAnalyzer
     24  public interface ISymbolicDataAnalysisValidationAnalyzer<T, U> : ISymbolicDataAnalysisAnalyzer, ISymbolicDataAnalysisInterpreterOperator
    2525    where T : class,ISymbolicDataAnalysisEvaluator<U>
    2626    where U : class, IDataAnalysisProblemData {
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs

    r5716 r5722  
    146146      SymbolicExpressionTreeInterpreter = new SymbolicDataAnalysisExpressionTreeInterpreter();
    147147
     148      InitializeOperators();
     149
    148150      UpdateGrammar();
    149151      UpdateDatasetPartitions();
    150152      RegisterEventHandlers();
    151       InitializeOperators();
    152153    }
    153154
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj

    r5681 r5722  
    118118    <Compile Include="Interfaces\Classification\IClassificationEnsembleModel.cs" />
    119119    <Compile Include="Interfaces\Regression\IRegressionEnsembleModel.cs" />
     120    <Compile Include="OnlineEvaluators\OnlineLinearScalingParameterCalculator.cs" />
    120121    <Compile Include="RegressionEnsembleModel.cs" />
    121122    <Compile Include="DiscriminantFunctionClassificationModel.cs" />
Note: See TracChangeset for help on using the changeset viewer.