Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17195


Ignore:
Timestamp:
08/09/19 09:02:36 (5 years ago)
Author:
gkronber
Message:

#2994: added early stopping and fixed a bug in ConstrainedConstantOptimizationEvaluator

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Extensions/ConstrainedConstantOptimizationEvaluator.cs

    r17176 r17195  
    240240      var targetMean = target.Average();
    241241      var pred = interpreter.GetSymbolicExpressionTreeValues(tree, problemData.Dataset, problemData.TrainingIndices).ToArray();
     242      if (pred.Any(pi => double.IsInfinity(pi) || double.IsNaN(pi))) return targetVariance;
     243
    242244      var predStDev = pred.StandardDeviationPop();
     245      if (predStDev == 0) return targetVariance; // constant expression
    243246      var predMean = pred.Average();
    244247
     
    441444
    442445      // evaluate tree with updated constants
    443       var residualVariance = SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator.Calculate(interpreter, scaledTree, lowerEstimationLimit, upperEstimationLimit, problemData, rows, applyLinearScaling: false);
     446      var residualVariance = SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator.Calculate(interpreter, tree, lowerEstimationLimit, upperEstimationLimit, problemData, rows, applyLinearScaling: true);
    444447      return Math.Min(residualVariance, targetVariance);
    445448    }
Note: See TracChangeset for help on using the changeset viewer.