Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/05/08 21:34:12 (15 years ago)
Author:
gkronber
Message:

fixed a stupid mistake introduced with r702 #328 (GP evaluation doesn't work in a thread parallel engine).

File:
1 edited

Legend:

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

    r702 r712  
    4747      double qualityLimit = GetVariableValue<DoubleData>("QualityLimit", scope, false).Data;
    4848      DoubleData mse = GetVariableValue<DoubleData>("MSE", scope, false, false);
    49       if(mse == null) {
     49      if (mse == null) {
    5050        mse = new DoubleData();
    5151        scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("MSE"), mse));
     
    5454      double errorsSquaredSum = 0;
    5555      int rows = end - start;
    56       for(int sample = start; sample < end; sample++) {
     56      for (int sample = start; sample < end; sample++) {
    5757        double estimated = evaluator.Evaluate(sample);
    58         double original = dataset.GetValue(targetVariable, sample);
    59         if(updateTargetValues) {
    60           dataset.SetValue(targetVariable, sample, estimated);
     58        double original = dataset.GetValue(sample, targetVariable);
     59        if (updateTargetValues) {
     60          dataset.SetValue(sample, targetVariable, estimated);
    6161        }
    62         if(!double.IsNaN(original) && !double.IsInfinity(original)) {
     62        if (!double.IsNaN(original) && !double.IsInfinity(original)) {
    6363          double error = estimated - original;
    6464          errorsSquaredSum += error * error;
    6565        }
    6666        // check the limit and stop as soon as we hit the limit
    67         if(errorsSquaredSum / rows >= qualityLimit) {
     67        if (errorsSquaredSum / rows >= qualityLimit) {
    6868          mse.Data = errorsSquaredSum / (sample - start + 1); // return estimated MSE (when the remaining errors are on average the same)
    6969          return;
     
    7171      }
    7272      errorsSquaredSum /= rows;
    73       if(double.IsNaN(errorsSquaredSum) || double.IsInfinity(errorsSquaredSum)) {
     73      if (double.IsNaN(errorsSquaredSum) || double.IsInfinity(errorsSquaredSum)) {
    7474        errorsSquaredSum = double.MaxValue;
    7575      }
Note: See TracChangeset for help on using the changeset viewer.