Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/02/10 18:10:15 (15 years ago)
Author:
gkronber
Message:

Implemented #824 (Refactor: ITreeEvaluator interface to provide a method that evaluates a tree on a range of samples.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/SimpleEvaluator.cs

    r2577 r2578  
    2323using HeuristicLab.Data;
    2424using HeuristicLab.DataAnalysis;
     25using HeuristicLab.GP.Interfaces;
     26using HeuristicLab.Modeling;
     27using System.Linq;
    2528
    2629namespace HeuristicLab.GP.StructureIdentification {
     
    3134    }
    3235
    33     public override void Evaluate(IScope scope, ITreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end) {
     36    public override void Evaluate(IScope scope, IFunctionTree tree, ITreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end) {
    3437      DoubleMatrixData values = GetVariableValue<DoubleMatrixData>("Values", scope, false, false);
    3538      if (values == null) {
     
    4245      }
    4346
    44       double[,] v = new double[end - start, 2];
    45 
    46       for (int sample = start; sample < end; sample++) {
    47         double estimated = evaluator.Evaluate(sample);
    48         double original = dataset.GetValue(sample, targetVariable);
    49        
    50         v[sample - start, 0] = original;
    51         v[sample - start, 1] = estimated;
    52       }
     47      double[,] v = Matrix<double>.Create(
     48        dataset.GetVariableValues(targetVariable, start, end),
     49        evaluator.Evaluate(dataset, tree, Enumerable.Range(start, end - start)).ToArray());
    5350      values.Data = v;
    5451    }
Note: See TracChangeset for help on using the changeset viewer.