Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5851


Ignore:
Timestamp:
03/28/11 20:04:51 (14 years ago)
Author:
gkronber
Message:

#1411 added evaluated nodes parameter to symbolic data analysis evaluators.

Location:
trunk/sources
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs

    r5809 r5851  
    2020#endregion
    2121
     22using System.Linq;
    2223using System.Collections.Generic;
    2324using HeuristicLab.Common;
     
    4647    public override IOperation Apply() {
    4748      IEnumerable<int> rows = GenerateRowsToEvaluate();
    48       double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows);
     49      var solution = SymbolicExpressionTreeParameter.ActualValue;
     50      double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows);
    4951      QualitiesParameter.ActualValue = new DoubleArray(qualities);
     52      AddEvaluatedNodes(solution.Length * rows.Count());
    5053      return base.Apply();
    5154    }
     
    6265      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
    6366      EstimationLimitsParameter.ExecutionContext = context;
     67      EvaluatedNodesParameter.ExecutionContext = context;
    6468
    6569      double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows);
     70      AddEvaluatedNodes(tree.Length * rows.Count());
    6671
    6772      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
    6873      EstimationLimitsParameter.ExecutionContext = null;
     74      EvaluatedNodesParameter.ExecutionContext = null;
    6975
    7076      return quality;
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs

    r5846 r5851  
    11using System;
     2using System.Linq;
    23using System.Collections.Generic;
    34using HeuristicLab.Common;
     
    2627    public override IOperation Apply() {
    2728      IEnumerable<int> rows = GenerateRowsToEvaluate();
    28       double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows);
     29      var solution = SymbolicExpressionTreeParameter.ActualValue;
     30      double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows);
    2931      QualitiesParameter.ActualValue = new DoubleArray(qualities);
     32      AddEvaluatedNodes(solution.Length * rows.Count());
    3033      return base.Apply();
    3134    }
     
    4144      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
    4245      EstimationLimitsParameter.ExecutionContext = context;
     46      EvaluatedNodesParameter.ExecutionContext = context;
    4347
    4448      double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows);
    45 
     49      AddEvaluatedNodes(tree.Length * rows.Count());
     50     
    4651      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
    4752      EstimationLimitsParameter.ExecutionContext = null;
     53      EvaluatedNodesParameter.ExecutionContext = null;
    4854
    4955      return quality;
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator.cs

    r5809 r5851  
    3333  [StorableClass]
    3434  public class SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator : SymbolicClassificationSingleObjectiveEvaluator {
    35 
    3635    [StorableConstructor]
    3736    protected SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator(bool deserializing) : base(deserializing) { }
     
    4746    public override IOperation Apply() {
    4847      IEnumerable<int> rows = GenerateRowsToEvaluate();
    49       double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows);
     48      var solution = SymbolicExpressionTreeParameter.ActualValue;
     49      double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows);
    5050      QualityParameter.ActualValue = new DoubleValue(quality);
     51      AddEvaluatedNodes(solution.Length * rows.Count());
    5152      return base.Apply();
    5253    }
     
    8889
    8990    public override double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IClassificationProblemData problemData, IEnumerable<int> rows) {
    90       return Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows);
     91      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
     92      EstimationLimitsParameter.ExecutionContext = context;
     93      EvaluatedNodesParameter.ExecutionContext = context;
     94
     95      double mse = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows);
     96      AddEvaluatedNodes(tree.Length * rows.Count());
     97
     98      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
     99      EstimationLimitsParameter.ExecutionContext = null;
     100      EvaluatedNodesParameter.ExecutionContext = null;
     101
     102      return mse;
    91103    }
    92104  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator.cs

    r5809 r5851  
    2020#endregion
    2121
     22using System.Linq;
    2223using System.Collections.Generic;
    2324using HeuristicLab.Common;
     
    4647    public override IOperation Apply() {
    4748      IEnumerable<int> rows = GenerateRowsToEvaluate();
    48       double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows);
     49      var solution = SymbolicExpressionTreeParameter.ActualValue;
     50      double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows);
    4951      QualityParameter.ActualValue = new DoubleValue(quality);
     52      AddEvaluatedNodes(solution.Length * rows.Count());
    5053      return base.Apply();
    5154    }
     
    6164      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
    6265      EstimationLimitsParameter.ExecutionContext = context;
     66      EvaluatedNodesParameter.ExecutionContext = context;
    6367
    6468      double mse = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows);
     69      AddEvaluatedNodes(tree.Length * rows.Count());
    6570
    6671      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
    6772      EstimationLimitsParameter.ExecutionContext = null;
     73      EvaluatedNodesParameter.ExecutionContext = null;
    6874
    6975      return mse;
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator.cs

    r5846 r5851  
    2121
    2222using System;
     23using System.Linq;
    2324using System.Collections.Generic;
    2425using HeuristicLab.Common;
     
    4748    public override IOperation Apply() {
    4849      IEnumerable<int> rows = GenerateRowsToEvaluate();
    49       double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows);
     50      var solution = SymbolicExpressionTreeParameter.ActualValue;
     51      double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows);
    5052      QualityParameter.ActualValue = new DoubleValue(quality);
     53      AddEvaluatedNodes(solution.Length * rows.Count());
    5154      return base.Apply();
    5255    }
     
    6265      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
    6366      EstimationLimitsParameter.ExecutionContext = context;
     67      EvaluatedNodesParameter.ExecutionContext = context;
    6468
    6569      double r2 = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows);
     70      AddEvaluatedNodes(tree.Length * rows.Count());
    6671
    6772      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
    6873      EstimationLimitsParameter.ExecutionContext = null;
     74      EvaluatedNodesParameter.ExecutionContext = null;
    6975
    7076      return r2;
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs

    r5809 r5851  
    2020#endregion
    2121
     22using System.Linq;
    2223using System.Collections.Generic;
    2324using HeuristicLab.Common;
     
    4647    public override Core.IOperation Apply() {
    4748      IEnumerable<int> rows = GenerateRowsToEvaluate();
    48       double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows);
     49      var solution = SymbolicExpressionTreeParameter.ActualValue;
     50      double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows);
    4951      QualitiesParameter.ActualValue = new DoubleArray(qualities);
     52      AddEvaluatedNodes(solution.Length * rows.Count());
    5053      return base.Apply();
    5154    }
     
    6265      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
    6366      EstimationLimitsParameter.ExecutionContext = context;
     67      EvaluatedNodesParameter.ExecutionContext = context;
    6468
    6569      double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows);
     70      AddEvaluatedNodes(tree.Length * rows.Count());
    6671
    6772      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
    6873      EstimationLimitsParameter.ExecutionContext = null;
     74      EvaluatedNodesParameter.ExecutionContext = null;
    6975
    7076      return quality;
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs

    r5846 r5851  
    2121
    2222using System;
     23using System.Linq;
    2324using System.Collections.Generic;
    2425using HeuristicLab.Common;
     
    4748    public override IOperation Apply() {
    4849      IEnumerable<int> rows = GenerateRowsToEvaluate();
    49       double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows);
     50      var solution = SymbolicExpressionTreeParameter.ActualValue;
     51      double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows);
    5052      QualitiesParameter.ActualValue = new DoubleArray(qualities);
     53      AddEvaluatedNodes(solution.Length * rows.Count());
    5154      return base.Apply();
    5255    }
     
    6265      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
    6366      EstimationLimitsParameter.ExecutionContext = context;
     67      EvaluatedNodesParameter.ExecutionContext = context;
    6468
    6569      double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows);
     70      AddEvaluatedNodes(tree.Length * rows.Count());
    6671
    6772      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
    6873      EstimationLimitsParameter.ExecutionContext = null;
     74      EvaluatedNodesParameter.ExecutionContext = null;
    6975
    7076      return quality;
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator.cs

    r5809 r5851  
    2020#endregion
    2121
     22using System.Linq;
    2223using System.Collections.Generic;
    2324using HeuristicLab.Common;
     
    4546
    4647    public override IOperation Apply() {
     48      var solution = SymbolicExpressionTreeParameter.ActualValue;
    4749      IEnumerable<int> rows = GenerateRowsToEvaluate();
    48       double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows);
    49       Quality = new DoubleValue(quality);
     50
     51      double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows);
     52      QualityParameter.ActualValue = new DoubleValue(quality);
     53      AddEvaluatedNodes(solution.Length * rows.Count());
     54
    5055      return base.Apply();
    5156    }
     
    6166      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
    6267      EstimationLimitsParameter.ExecutionContext = context;
     68      EvaluatedNodesParameter.ExecutionContext = context;
    6369
    6470      double mse = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows);
    6571
     72      AddEvaluatedNodes(tree.Length * rows.Count());
     73
    6674      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
    6775      EstimationLimitsParameter.ExecutionContext = null;
     76      EvaluatedNodesParameter.ExecutionContext = null;
    6877
    6978      return mse;
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.cs

    r5846 r5851  
    2121
    2222using System;
     23using System.Linq;
    2324using System.Collections.Generic;
    2425using HeuristicLab.Common;
     
    4647
    4748    public override IOperation Apply() {
     49      var solution = SymbolicExpressionTreeParameter.ActualValue;
    4850      IEnumerable<int> rows = GenerateRowsToEvaluate();
    49       double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows);
    50       Quality = new DoubleValue(quality);
     51
     52      double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows);
     53      QualityParameter.ActualValue = new DoubleValue(quality);
     54      AddEvaluatedNodes(solution.Length * rows.Count());
     55
    5156      return base.Apply();
    5257    }
     
    6267      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
    6368      EstimationLimitsParameter.ExecutionContext = context;
     69      EvaluatedNodesParameter.ExecutionContext = context;
    6470
    6571      double r2 = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows);
     72      AddEvaluatedNodes(tree.Length * rows.Count());
    6673
    6774      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
    6875      EstimationLimitsParameter.ExecutionContext = null;
     76      EvaluatedNodesParameter.ExecutionContext = null;
    6977
    7078      return r2;
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Evaluators/SymbolicDataAnalysisEvaluator.cs

    r5823 r5851  
    4444    private const string EvaluationPartitionParameterName = "EvaluationPartition";
    4545    private const string RelativeNumberOfEvaluatedSamplesParameterName = "RelativeNumberOfEvaluatedSamples";
     46    private const string EvaluatedNodesParameterName = "EvaluatedNodes";
    4647
    4748    public override bool CanChangeName { get { return false; } }
     
    5657    public ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter> SymbolicDataAnalysisTreeInterpreterParameter {
    5758      get { return (ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>)Parameters[SymbolicDataAnalysisTreeInterpreterParameterName]; }
     59    }
     60    public ILookupParameter<DoubleValue> EvaluatedNodesParameter {
     61      get { return (ILookupParameter<DoubleValue>)Parameters[EvaluatedNodesParameterName]; }
    5862    }
    5963    public IValueLookupParameter<T> ProblemDataParameter {
     
    8387      Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The interpreter that should be used to calculate the output values of the symbolic data analysis tree."));
    8488      Parameters.Add(new LookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic data analysis solution encoded as a symbolic expression tree."));
     89      Parameters.Add(new LookupParameter<DoubleValue>(EvaluatedNodesParameterName, "The total number of evaluated symbolic expression tree nodes."));
    8590      Parameters.Add(new ValueLookupParameter<T>(ProblemDataParameterName, "The problem data on which the symbolic data analysis solution should be evaluated."));
    8691      Parameters.Add(new ValueLookupParameter<IntRange>(EvaluationPartitionParameterName, "The start index of the dataset partition on which the symbolic data analysis solution should be evaluated."));
     
    102107        .Where(i => i < testPartitionStart || testPartitionEnd <= i);
    103108    }
     109
     110    protected void AddEvaluatedNodes(double numberOfNodes) {
     111      if (EvaluatedNodesParameter.ActualValue == null) EvaluatedNodesParameter.ActualValue = new DoubleValue();
     112      double curEvaluatedNodes = EvaluatedNodesParameter.ActualValue.Value;
     113      EvaluatedNodesParameter.ActualValue = new DoubleValue(curEvaluatedNodes + numberOfNodes);
     114    }
    104115  }
    105116}
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Evaluators/SymbolicDataAnalysisSingleObjectiveEvaluator.cs

    r5809 r5851  
    2020#endregion
    2121
     22using System.Linq;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
     
    3940    #endregion
    4041    #region properties
    41     public DoubleValue Quality {
    42       get { return QualityParameter.ActualValue; }
    43       set { QualityParameter.ActualValue = value; }
    44     }
    4542    public abstract bool Maximization { get; }
    4643    #endregion
     
    5653    }
    5754
    58 
    5955    public abstract double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, T problemData, IEnumerable<int> rows);
    6056  }
Note: See TracChangeset for help on using the changeset viewer.