Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/07/08 16:59:35 (16 years ago)
Author:
gkronber
Message:

fixed small bugs in GP evaluators

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.StructureIdentification/Evaluation/VarianceAccountedForEvaluator.cs

    r363 r367  
    5454
    5555    public override double Evaluate(IScope scope, IFunctionTree functionTree, int targetVariable, Dataset dataset) {
    56       double[] errors = new double[dataset.Rows];
    57       double[] originalTargetVariableValues = new double[dataset.Rows];
    58       double targetMean = dataset.GetMean(targetVariable);
     56      int trainingStart = GetVariableValue<IntData>("TrainingSamplesStart", scope, true).Data;
     57      int trainingEnd = GetVariableValue<IntData>("TrainingSamplesEnd", scope, true).Data;
     58      double[] errors = new double[trainingEnd-trainingStart];
     59      double[] originalTargetVariableValues = new double[trainingEnd-trainingStart];
     60      double targetMean = dataset.GetMean(targetVariable, trainingStart, trainingEnd);
    5961      functionTree.PrepareEvaluation(dataset);
    60       for(int sample = 0; sample < dataset.Rows; sample++) {
     62      for(int sample = trainingStart; sample < trainingEnd; sample++) {
    6163        double estimated = functionTree.Evaluate(sample);
    6264        double original = dataset.GetValue(sample, targetVariable);
     
    7072        }
    7173
    72         errors[sample] = original - estimated;
    73         originalTargetVariableValues[sample] = original;
     74        errors[sample-trainingStart] = original - estimated;
     75        originalTargetVariableValues[sample-trainingStart] = original;
    7476      }
    7577
Note: See TracChangeset for help on using the changeset viewer.