Changeset 15994


Ignore:
Timestamp:
07/11/18 16:43:41 (3 years ago)
Author:
bburlacu
Message:

#2886: Add symbolic regression solution to results during algorithm run and scale model.

Location:
branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration
Files:
2 edited

Legend:

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

    r15993 r15994  
    8686
    8787      if (algorithm.BestTrainingSentence == null || r2 > bestR2 || (r2.IsAlmost(bestR2) && complexity < bestComplexity)) {
    88         results.AddOrUpdateResult(BestTrainingQualityResultName, new DoubleValue(r2));
     88        algorithm.BestTrainingSentence = symbolString;
     89
     90        var model = new SymbolicRegressionModel(problemData.TargetVariable, tree, expressionTreeLinearInterpreter);
     91        model.Scale(problemData);
     92        var bestSolution = model.CreateRegressionSolution(problemData);
     93
     94        results.AddOrUpdateResult(BestTrainingQualityResultName, new DoubleValue(bestSolution.TrainingRSquared));
     95        results.AddOrUpdateResult(BestTestQualityResultName, new DoubleValue(bestSolution.TestRSquared));
     96        results.AddOrUpdateResult(BestTrainingModelResultName, bestSolution.Model);
     97        results.AddOrUpdateResult(BestTrainingSolutionResultName, bestSolution);
    8998        results.AddOrUpdateResult(BestComplexityResultName, new IntValue(complexity));
    90         algorithm.BestTrainingSentence = symbolString;
    9199
    92100        // record best sentence quality & length
  • branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/GrammarEnumeration/GrammarEnumerationAlgorithm.cs

    r15993 r15994  
    390390        updateConstantsInTree: true);
    391391
     392      model.Scale(Problem.ProblemData);
    392393      var bestTrainingSolution = new SymbolicRegressionSolution(model, Problem.ProblemData);
     394
    393395      Results.AddOrUpdateResult(BestTrainingModelResultName, model);
    394396      Results.AddOrUpdateResult(BestTrainingSolutionResultName, bestTrainingSolution);
Note: See TracChangeset for help on using the changeset viewer.