Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/17/18 16:59:57 (6 years ago)
Author:
lkammere
Message:

#2886: Fix length parameter when priorizing phrases and add weighting parameter to control exploration/exploitation during search, fix copy constructors in Analyzers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/Analysis/RSquaredEvaluator.cs

    r15883 r15910  
    2323    public RSquaredEvaluator() { }
    2424
    25     protected RSquaredEvaluator(RSquaredEvaluator original, Cloner cloner) {
     25    protected RSquaredEvaluator(RSquaredEvaluator original, Cloner cloner) : base(original, cloner) {
    2626      this.OptimizeConstants = original.OptimizeConstants;
    2727    }
     
    5252    private void OnStarted(object sender, EventArgs eventArgs) {
    5353      GrammarEnumerationAlgorithm algorithm = (GrammarEnumerationAlgorithm)sender;
    54       algorithm.Results.Add(new Result(BestTrainingQualityResultName, new DoubleValue(-1.0)));
    5554
    5655      algorithm.BestTrainingSentence = null;
     
    7574      double r2 = Evaluate(problemData, tree, OptimizeConstants);
    7675
    77       var bestR2Result = (DoubleValue)algorithm.Results[BestTrainingQualityResultName].Value;
    78       bool better = r2 > bestR2Result.Value;
    79       bool equallyGood = r2.IsAlmost(bestR2Result.Value);
     76      double bestR2 = 0.0;
     77      if (algorithm.Results.ContainsKey(BestTrainingQualityResultName))
     78        bestR2 = ((DoubleValue)algorithm.Results[BestTrainingQualityResultName].Value).Value;
     79      bool better = r2 > bestR2;
     80      bool equallyGood = r2.IsAlmost(bestR2);
    8081      bool shorter = false;
    8182
     
    8586      }
    8687      if (better || (equallyGood && shorter)) {
    87         bestR2Result.Value = r2;
     88        algorithm.Results.AddOrUpdateResult(BestTrainingQualityResultName, new DoubleValue(r2));
    8889
    8990        SymbolicRegressionModel model = new SymbolicRegressionModel(
Note: See TracChangeset for help on using the changeset viewer.