Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1796


Ignore:
Timestamp:
05/14/09 13:46:57 (16 years ago)
Author:
gkronber
Message:

Refactored GP evaluation to make it possible to use different evaluators to interpret function trees. #615 (Evaluation of HL3 function trees should be equivalent to evaluation in HL2)

Location:
trunk/sources
Files:
2 added
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/3.3/AccuracyEvaluator.cs

    r1529 r1796  
    4343    }
    4444
    45     public override void Evaluate(IScope scope, BakedTreeEvaluator evaluator, Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end) {
     45    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end) {
    4646      DoubleData accuracy = GetVariableValue<DoubleData>("Accuracy", scope, false, false);
    4747      if (accuracy == null) {
     
    5353      int nCorrect = 0;
    5454      for (int sample = start; sample < end; sample++) {
    55         double est = evaluator.Evaluate(sample);
     55        double est = evaluator.Evaluate(tree, sample);
    5656        double origClass = dataset.GetValue(sample, targetVariable);
    5757        double estClass = double.NaN;
  • trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/3.3/ClassificationMeanSquaredErrorEvaluator.cs

    r1529 r1796  
    4343    }
    4444
    45     public override void Evaluate(IScope scope, BakedTreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end) {
     45    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end) {
    4646      double errorsSquaredSum = 0;
    4747      for (int sample = start; sample < end; sample++) {
    48         double estimated = evaluator.Evaluate(sample);
     48        double estimated = evaluator.Evaluate(tree, sample);
    4949        double original = dataset.GetValue(sample, targetVariable);
    5050        if (!double.IsNaN(original) && !double.IsInfinity(original)) {
  • trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/3.3/ConfusionMatrixEvaluator.cs

    r1529 r1796  
    4141    }
    4242
    43     public override void Evaluate(IScope scope, BakedTreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end) {
     43    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end) {
    4444      IntMatrixData matrix = GetVariableValue<IntMatrixData>("ConfusionMatrix", scope, false, false);
    4545      if (matrix == null) {
     
    5050      int nSamples = end - start;
    5151      for (int sample = start; sample < end; sample++) {
    52         double est = evaluator.Evaluate(sample);
     52        double est = evaluator.Evaluate(tree, sample);
    5353        double origClass = dataset.GetValue(sample, targetVariable);
    5454        int estClassIndex = -1;
  • trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/3.3/GPClassificationEvaluatorBase.cs

    r1529 r1796  
    3737    }
    3838
    39     public override void Evaluate(IScope scope, BakedTreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
     39    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
    4040
    4141      ItemList<DoubleData> classes = GetVariableValue<ItemList<DoubleData>>("TargetClassValues", scope, true);
     
    4848      }
    4949
    50       Evaluate(scope, evaluator, dataset, targetVariable, classesArr, thresholds, start, end);
     50      Evaluate(scope, evaluator, tree, dataset, targetVariable, classesArr, thresholds, start, end);
    5151    }
    5252
    53     public abstract void Evaluate(IScope scope, BakedTreeEvaluator evaluator, Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end);
     53    public abstract void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end);
    5454  }
    5555}
  • trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/3.3/MulticlassOneVsOneAnalyzer.cs

    r1529 r1796  
    3535    private const string TARGETVARIABLE = "TargetVariable";
    3636    private const string TARGETCLASSVALUES = "TargetClassValues";
     37    private const string TRAININGSAMPLESSTART = "TrainingSamplesStart";
     38    private const string TRAININGSAMPLESEND = "TrainingSamplesEnd";
    3739    private const string SAMPLESSTART = "SamplesStart";
    3840    private const string SAMPLESEND = "SamplesEnd";
     
    5658      AddVariableInfo(new VariableInfo(CLASSAVALUE, "The original class value of the class A in the subscope", typeof(DoubleData), VariableKind.In));
    5759      AddVariableInfo(new VariableInfo(CLASSBVALUE, "The original class value of the class B in the subscope", typeof(DoubleData), VariableKind.In));
     60      AddVariableInfo(new VariableInfo(TRAININGSAMPLESSTART, "The start of training samples in the original dataset", typeof(IntData), VariableKind.In));
     61      AddVariableInfo(new VariableInfo(TRAININGSAMPLESEND, "The end of training samples in the original dataset", typeof(IntData), VariableKind.In));
    5862      AddVariableInfo(new VariableInfo(SAMPLESSTART, "The start of samples in the original dataset", typeof(IntData), VariableKind.In));
    5963      AddVariableInfo(new VariableInfo(SAMPLESEND, "The end of samples in the original dataset", typeof(IntData), VariableKind.In));
     
    6771      Dataset dataset = GetVariableValue<Dataset>(DATASET, scope, true);
    6872      int targetVariable = GetVariableValue<IntData>(TARGETVARIABLE, scope, true).Data;
     73      int trainingSamplesStart = GetVariableValue<IntData>(TRAININGSAMPLESSTART, scope, true).Data;
     74      int trainingSamplesEnd = GetVariableValue<IntData>(TRAININGSAMPLESEND, scope, true).Data;
    6975      int samplesStart = GetVariableValue<IntData>(SAMPLESSTART, scope, true).Data;
    7076      int samplesEnd = GetVariableValue<IntData>(SAMPLESEND, scope, true).Data;
     
    7985
    8086        BakedTreeEvaluator evaluator = new BakedTreeEvaluator();
    81         evaluator.ResetEvaluator(functionTree, dataset, targetVariable, samplesStart, samplesEnd, 1.0);
     87        evaluator.ResetEvaluator(dataset, targetVariable, trainingSamplesStart, trainingSamplesEnd, 1.0);
    8288
    8389        for(int i = 0; i < (samplesEnd - samplesStart); i++) {
    84           double est = evaluator.Evaluate(i + samplesStart);
     90          double est = evaluator.Evaluate(functionTree, i + samplesStart);
    8591          if(est < 0.5) {
    8692            CastVote(votes, i, classAValue, classValues);
  • trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/3.3/AveragePercentageChangeEvaluator.cs

    r1529 r1796  
    4242    }
    4343
    44     public override void Evaluate(IScope scope, BakedTreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
     44    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
    4545      bool differential = GetVariableValue<BoolData>("Differential", scope, true).Data;
    4646      DoubleData apc = GetVariableValue<DoubleData>("APC", scope, false, false);
     
    5858          prevOriginal = dataset.GetValue(sample - 1, targetVariable);
    5959          originalPercentageChange = (dataset.GetValue(sample, targetVariable) - prevOriginal) / prevOriginal;
    60           estimatedPercentageChange = (evaluator.Evaluate(sample) - prevOriginal) / prevOriginal;
     60          estimatedPercentageChange = (evaluator.Evaluate(tree, sample) - prevOriginal) / prevOriginal;
    6161          if (updateTargetValues) {
    6262            dataset.SetValue(sample, targetVariable, estimatedPercentageChange * prevOriginal + prevOriginal);
     
    6464        } else {
    6565          originalPercentageChange = dataset.GetValue(sample, targetVariable);
    66           estimatedPercentageChange = evaluator.Evaluate(sample);
     66          estimatedPercentageChange = evaluator.Evaluate(tree, sample);
    6767          if (updateTargetValues) {
    6868            dataset.SetValue(sample, targetVariable, estimatedPercentageChange);
  • trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/3.3/ProfitEvaluator.cs

    r1529 r1796  
    4343    }
    4444
    45     public override void Evaluate(IScope scope, BakedTreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
     45    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
    4646      int exchangeRateVarIndex = GetVariableValue<IntData>("ExchangeRate", scope, true).Data;
    4747      double transactionCost = GetVariableValue<DoubleData>("TransactionCost", scope, true).Data;
     
    5858        exchangeRate = dataset.GetValue(sample, exchangeRateVarIndex);
    5959        double originalPercentageChange = dataset.GetValue(sample, targetVariable);
    60         double estimatedPercentageChange = evaluator.Evaluate(sample);
     60        double estimatedPercentageChange = evaluator.Evaluate(tree, sample);
    6161        if (updateTargetValues) {
    6262          dataset.SetValue(sample, targetVariable, estimatedPercentageChange);
  • trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/3.3/TheilInequalityCoefficientEvaluator.cs

    r1529 r1796  
    5454    }
    5555
    56     public override void Evaluate(IScope scope, BakedTreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
     56    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
    5757      #region create result variables
    5858      DoubleData theilInequaliy = GetVariableValue<DoubleData>("TheilInequalityCoefficient", scope, false, false);
     
    8585      for (int sample = start; sample < end; sample++) {
    8686        double prevValue = dataset.GetValue(sample - 1, targetVariable);
    87         double estimatedChange = evaluator.Evaluate(sample) - prevValue;
     87        double estimatedChange = evaluator.Evaluate(tree, sample) - prevValue;
    8888        double originalChange = dataset.GetValue(sample, targetVariable) - prevValue;
    8989        if (updateTargetValues) {
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/BakedTreeEvaluator.cs

    r1787 r1796  
    3434  /// Not thread-safe!
    3535  /// </summary>
    36   public class BakedTreeEvaluator {
     36  public class BakedTreeEvaluator : ItemBase, ITreeEvaluator {
    3737    private const double EPSILON = 1.0e-7;
    3838    private double estimatedValueMax;
     
    5353    private int sampleIndex;
    5454
    55     public void ResetEvaluator(BakedFunctionTree functionTree, Dataset dataset, int targetVariable, int start, int end, double punishmentFactor) {
     55    public void ResetEvaluator(Dataset dataset, int targetVariable, int start, int end, double punishmentFactor) {
    5656      this.dataset = dataset;
    5757      double maximumPunishment = punishmentFactor * dataset.GetRange(targetVariable, start, end);
     
    6262      estimatedValueMax = targetMean + maximumPunishment;
    6363
    64       List<LightWeightFunction> linearRepresentation = functionTree.LinearRepresentation;
    65       codeArr = new Instr[linearRepresentation.Count];
    66       int i = 0;
    67       foreach (LightWeightFunction f in linearRepresentation) {
    68         codeArr[i++] = TranslateToInstr(f);
    69       }
    7064    }
    7165
     
    9488    }
    9589
    96     public double Evaluate(int sampleIndex) {
     90    public double Evaluate(IFunctionTree functionTree, int sampleIndex) {
     91      BakedFunctionTree bakedTree = functionTree as BakedFunctionTree;
     92      if (bakedTree == null) throw new ArgumentException("BakedTreeEvaluator can only evaluate BakedFunctionTrees");
     93
     94      List<LightWeightFunction> linearRepresentation = bakedTree.LinearRepresentation;
     95      codeArr = new Instr[linearRepresentation.Count];
     96      int i = 0;
     97      foreach (LightWeightFunction f in linearRepresentation) {
     98        codeArr[i++] = TranslateToInstr(f);
     99      }
     100
    97101      PC = 0;
    98102      this.sampleIndex = sampleIndex;
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/CoefficientOfDeterminationEvaluator.cs

    r712 r1796  
    4242    }
    4343
    44     public override void Evaluate(IScope scope, BakedTreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
     44    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
    4545      double errorsSquaredSum = 0.0;
    4646      double originalDeviationTotalSumOfSquares = 0.0;
    4747      double targetMean = dataset.GetMean(targetVariable, start, end);
     48
     49      double originalSum = 0.0;
     50      int n = 0;
    4851      for (int sample = start; sample < end; sample++) {
    49         double estimated = evaluator.Evaluate(sample);
     52        double estimated = evaluator.Evaluate(tree, sample);
    5053        double original = dataset.GetValue(sample, targetVariable);
    5154        if (updateTargetValues) {
     
    5659          errorsSquaredSum += error * error;
    5760
    58           double origDeviation = original - targetMean;
    59           originalDeviationTotalSumOfSquares += origDeviation * origDeviation;
     61          originalSum += original;
     62          n++;
     63        }
     64      }
     65
     66      double originalMean = originalSum / n;
     67      for(int sample = start; sample < end; sample++){
     68        double original = dataset.GetValue(sample, targetVariable);
     69        if (!double.IsNaN(original) && !double.IsInfinity(original)) {
     70          original = original - originalMean;
     71          original = original * original;
     72          originalDeviationTotalSumOfSquares += original;
    6073        }
    6174      }
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/EarlyStoppingMeanSquaredErrorEvaluator.cs

    r1794 r1796  
    4444
    4545    // evaluates the function-tree for the given target-variable and the whole dataset and returns the MSE
    46     public override void Evaluate(IScope scope, BakedTreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
     46    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
    4747      double qualityLimit = GetVariableValue<DoubleData>("QualityLimit", scope, false).Data;
    4848      DoubleData mse = GetVariableValue<DoubleData>("MSE", scope, false, false);
     
    5656      int n = 0;
    5757      for (int sample = start; sample < end; sample++) {
    58         double estimated = evaluator.Evaluate(sample);
     58        double estimated = evaluator.Evaluate(tree, sample);
    5959        double original = dataset.GetValue(sample, targetVariable);
    6060        if (updateTargetValues) {
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/GPEvaluatorBase.cs

    r712 r1796  
    3333    public GPEvaluatorBase()
    3434      : base() {
     35      AddVariableInfo(new VariableInfo("TreeEvaluator", "The evaluator that should be used to evaluate the expression tree", typeof(ITreeEvaluator), VariableKind.In));
    3536      AddVariableInfo(new VariableInfo("FunctionTree", "The function tree that should be evaluated", typeof(IFunctionTree), VariableKind.In));
    3637      AddVariableInfo(new VariableInfo("TreeSize", "Size (number of nodes) of the tree to evaluate", typeof(IntData), VariableKind.In));
     
    4849      int targetVariable = GetVariableValue<IntData>("TargetVariable", scope, true).Data;
    4950      Dataset dataset = GetVariableValue<Dataset>("Dataset", scope, true);
    50       BakedFunctionTree functionTree = GetVariableValue<BakedFunctionTree>("FunctionTree", scope, true);
     51      IFunctionTree functionTree = GetVariableValue<IFunctionTree>("FunctionTree", scope, true);
    5152      double punishmentFactor = GetVariableValue<DoubleData>("PunishmentFactor", scope, true).Data;
    5253      int treeSize = scope.GetVariableValue<IntData>("TreeSize", false).Data;
     
    5556      int end = GetVariableValue<IntData>("SamplesEnd", scope, true).Data;
    5657      bool useEstimatedValues = GetVariableValue<BoolData>("UseEstimatedTargetValue", scope, true).Data;
     58      ITreeEvaluator evaluator = GetVariableValue<ITreeEvaluator>("TreeEvaluator", scope, true);
     59
    5760      double[] backupValues = null;
    5861      // prepare for autoregressive modelling by saving the original values of the target-variable to a backup array
     
    6568      }
    6669
    67       // initialize and reset the evaluator
    68       BakedTreeEvaluator evaluator = new BakedTreeEvaluator();
    69       evaluator.ResetEvaluator(functionTree, dataset, targetVariable, start, end, punishmentFactor);
    70 
    71       Evaluate(scope, evaluator, dataset, targetVariable, start, end, useEstimatedValues);
     70      Evaluate(scope, evaluator, functionTree, dataset, targetVariable, start, end, useEstimatedValues);
    7271
    7372      // restore the values of the target variable from the backup array if necessary
     
    8382    }
    8483
    85     public abstract void Evaluate(IScope scope, BakedTreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues);
     84    public abstract void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues);
    8685  }
    8786}
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/MeanAbsolutePercentageErrorEvaluator.cs

    r712 r1796  
    4343    }
    4444
    45     public override void Evaluate(IScope scope, BakedTreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
     45    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
    4646      double errorsSum = 0.0;
    4747      int n = 0;
    4848      for (int sample = start; sample < end; sample++) {
    49         double estimated = evaluator.Evaluate(sample);
     49        double estimated = evaluator.Evaluate(tree, sample);
    5050        double original = dataset.GetValue(sample, targetVariable);
    5151
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/MeanAbsolutePercentageOfRangeErrorEvaluator.cs

    r1287 r1796  
    4343    }
    4444
    45     public override void Evaluate(IScope scope, BakedTreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
     45    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
    4646      double errorsSum = 0.0;
    4747      int n = 0;
    4848      double range = dataset.GetRange(targetVariable, start, end);
    4949      for (int sample = start; sample < end; sample++) {
    50         double estimated = evaluator.Evaluate(sample);
     50        double estimated = evaluator.Evaluate(tree, sample);
    5151        double original = dataset.GetValue(sample, targetVariable);
    5252
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/MeanSquaredErrorEvaluator.cs

    r1794 r1796  
    4343    }
    4444
    45     public override void Evaluate(IScope scope, BakedTreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
     45    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
    4646      double errorsSquaredSum = 0;
    4747      int n = 0;
    4848      for (int sample = start; sample < end; sample++) {
    4949        double original = dataset.GetValue(sample, targetVariable);
    50         double estimated = evaluator.Evaluate(sample);
     50        double estimated = evaluator.Evaluate(tree, sample);
    5151        if (updateTargetValues) {
    5252          dataset.SetValue(sample, targetVariable, estimated);
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/SimpleEvaluator.cs

    r712 r1796  
    3636    }
    3737
    38     public override void Evaluate(IScope scope, BakedTreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
     38    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
    3939      ItemList values = GetVariableValue<ItemList>("Values", scope, false, false);
    4040      if (values == null) {
     
    5050      for (int sample = start; sample < end; sample++) {
    5151        ItemList row = new ItemList();
    52         double estimated = evaluator.Evaluate(sample);
     52        double estimated = evaluator.Evaluate(tree, sample);
    5353        double original = dataset.GetValue(sample, targetVariable);
    5454        if (updateTargetValues) {
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/UncertainMeanSquaredErrorEvaluator.cs

    r769 r1796  
    5050
    5151    // evaluates the function-tree for the given target-variable and the whole dataset and returns the MSE
    52     public override void Evaluate(IScope scope, BakedTreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
     52    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
    5353      double qualityLimit = GetVariableValue<DoubleData>("QualityLimit", scope, false).Data;
    5454      int minSamples = GetVariableValue<IntData>("MinEvaluatedSamples", scope, true).Data;
     
    7878      int n = 0;
    7979      for (int sample = 0; sample < rows; sample++) {
    80         double estimated = evaluator.Evaluate(indexes[sample]);
     80        double estimated = evaluator.Evaluate(tree, indexes[sample]);
    8181        double original = dataset.GetValue(indexes[sample], targetVariable);
    8282        if (!double.IsNaN(original) && !double.IsInfinity(original)) {
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/VarianceAccountedForEvaluator.cs

    r712 r1796  
    5353    }
    5454
    55     public override void Evaluate(IScope scope, BakedTreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
     55    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
    5656      int nSamples = end - start;
    5757      double[] errors = new double[nSamples];
    5858      double[] originalTargetVariableValues = new double[nSamples];
    5959      for (int sample = start; sample < end; sample++) {
    60         double estimated = evaluator.Evaluate(sample);
     60        double estimated = evaluator.Evaluate(tree, sample);
    6161        double original = dataset.GetValue(sample, targetVariable);
    6262        if (updateTargetValues) {
     
    6666          errors[sample - start] = original - estimated;
    6767          originalTargetVariableValues[sample - start] = original;
     68        } else {
     69          errors[sample - start] = double.NaN;
     70          originalTargetVariableValues[sample - start] = double.NaN;
    6871        }
    6972      }
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/HeuristicLab.GP.StructureIdentification-3.3.csproj

    r1572 r1796  
    8989    <Compile Include="Constant.cs" />
    9090    <Compile Include="AlgorithmBase.cs" />
     91    <Compile Include="TreeEvaluatorInjector.cs" />
     92    <Compile Include="ITreeEvaluator.cs" />
    9193    <Compile Include="Evaluators\MeanAbsolutePercentageOfRangeErrorEvaluator.cs" />
    9294    <Compile Include="FunctionLibraryInjector.cs" />
Note: See TracChangeset for help on using the changeset viewer.