Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15985


Ignore:
Timestamp:
07/05/18 15:33:21 (6 years ago)
Author:
bburlacu
Message:

#2886: Simplify code in RSquaredEvaluator. Turn on linear scaling for the constant optimization evaluator.

File:
1 edited

Legend:

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

    r15982 r15985  
    8383        return;
    8484
    85       var bestComplexity = int.MaxValue;
    86       if (results.ContainsKey(BestComplexityResultName)) {
    87         bestComplexity = GetValue<int>(results[BestComplexityResultName].Value);
    88       } else if (algorithm.BestTrainingSentence != null) {
    89         bestComplexity = grammar.GetComplexity(algorithm.BestTrainingSentence);
    90         results.AddOrUpdateResult(BestComplexityResultName, new IntValue(bestComplexity));
    91       }
     85      var bestComplexity = results.ContainsKey(BestComplexityResultName) ? GetValue<int>(results[BestComplexityResultName].Value) : int.MaxValue;
    9286      var complexity = grammar.GetComplexity(symbolString);
    9387
    94       if (r2 > bestR2 || (r2.IsAlmost(bestR2) && complexity < bestComplexity)) {
     88      if (algorithm.BestTrainingSentence == null || r2 > bestR2 || (r2.IsAlmost(bestR2) && complexity < bestComplexity)) {
    9589        results.AddOrUpdateResult(BestTrainingQualityResultName, new DoubleValue(r2));
    9690        results.AddOrUpdateResult(BestComplexityResultName, new IntValue(complexity));
     
    109103          problemData,
    110104          problemData.TrainingIndices,
    111           applyLinearScaling: false,
     105          applyLinearScaling: true,
    112106          maxIterations: 10,
    113107          updateVariableWeights: false,
Note: See TracChangeset for help on using the changeset viewer.