Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/14/16 16:56:57 (8 years ago)
Author:
bburlacu
Message:

#2635: Small refactor.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.OSGAEvaluator/HeuristicLab.OSGAEvaluator/SymbolicRegressionSingleObjectiveOSGAEvaluator.cs

    r14279 r14280  
    206206      var e = estimatedValues.GetEnumerator();
    207207
     208      #region fixed intervals
    208209      if (UseFixedEvaluationIntervals) {
    209210        double threshold = parentQuality * RelativeParentChildQualityThreshold;
     
    289290          return actualQuality;
    290291        }
     292        #endregion
    291293      } else {
    292294        var calculator = new OnlinePearsonsRCalculator();
     
    298300        // if the quality of the individual still falls below the parent quality, then we can reject it sooner, otherwise as i increases the whole estimated series will be used
    299301        for (int i = 0; i < trainingPartitionSize; i += interval) {
     302          calculator.Reset();
     303          // save estimated values into the list (for caching)
    300304          int j = i;
    301305          int end = Math.Min(trainingPartitionSize, i + interval);
     
    304308            j++;
    305309          }
    306 
    307310          var start = problemData.TrainingPartition.Start;
    308           calculator.Reset();
    309311          // add (estimated, target) pairs to the calculator
    310           for (j = 0; j < end; ++j)
    311             calculator.Add(estimated[j], targetValues[j + start]);
     312          for (j = 0; j < end; ++j) {
     313            var index = j + start;
     314            calculator.Add(targetValues[index], estimated[j]);
     315          }
    312316          // add (target, target) pairs to the calculator (simulate perfect correlation on the remaining rows)
    313317          for (; j < trainingPartitionSize; ++j) {
    314318            var index = j + start;
    315             calculator.Add(targetValues[index], targetValues[index]);
     319            var v = targetValues[index];
     320            calculator.Add(v, v);
    316321          }
    317322          var r = calculator.ErrorState == OnlineCalculatorError.None ? calculator.R : double.NaN;
Note: See TracChangeset for help on using the changeset viewer.