Free cookie consent management tool by TermsFeed Policy Generator

Changeset 16142


Ignore:
Timestamp:
09/14/18 14:53:42 (6 years ago)
Author:
lkammere
Message:

#2886: Fix refreshing of pareto front. Add test quality value to pareto front.

File:
1 edited

Legend:

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

    r16090 r16142  
    4747    public static readonly string ParetoFrontSolutionsResultName = "Pareto Front Solutions";
    4848
     49    public static readonly string ParetoFrontSolutionHistoryResultName = "";
     50
    4951    private static readonly ISymbolicDataAnalysisExpressionTreeInterpreter expressionTreeLinearInterpreter = new SymbolicDataAnalysisExpressionTreeLinearInterpreter();
    5052
     
    109111          ? GetValue<double>(results[BestTrainingQualityResultName].Value)
    110112          : 0.0;
     113        bestR2 = double.IsNaN(bestR2)
     114          ? 0.0
     115          : bestR2;
     116
    111117        var bestComplexity = results.ContainsKey(BestComplexityResultName) ? GetValue<int>(results[BestComplexityResultName].Value) : int.MaxValue;
    112118        var complexity = sentence.Complexity;
     
    178184        var scatterPlot = new ScatterPlot(ParetoFrontAnalysisResultName, ParetoFrontAnalysisResultName);
    179185        algorithm.Results.Add(new Result(ParetoFrontAnalysisResultName, scatterPlot));
    180         scatterPlot.Rows.Add(new ScatterPlotDataRow());
     186        scatterPlot.Rows.Add(new ScatterPlotDataRow("Training", "", Enumerable.Empty<Point2D<double>>()));
     187        scatterPlot.Rows.Add(new ScatterPlotDataRow("Test", "", Enumerable.Empty<Point2D<double>>()));
    181188
    182189        scatterPlot.VisualProperties.XAxisTitle = "Complexity";
    183190        scatterPlot.VisualProperties.YAxisTitle = "R²";
    184         scatterPlot.Rows.First().VisualProperties.PointSize = 10;
     191        foreach (ScatterPlotDataRow scatterPlotDataRow in scatterPlot.Rows) {
     192          scatterPlotDataRow.VisualProperties.PointSize = 10;
     193        }
    185194      }
    186195
    187196      ItemList<DoubleArray> paretoFront = (ItemList<DoubleArray>)algorithm.Results[ParetoFrontResultName].Value;
    188       ScatterPlotDataRow plot = ((ScatterPlot)algorithm.Results[ParetoFrontAnalysisResultName].Value).Rows.First();
     197      ScatterPlotDataRow plotTraining = ((ScatterPlot)algorithm.Results[ParetoFrontAnalysisResultName].Value).Rows["Training"];
     198      ScatterPlotDataRow plotTest = ((ScatterPlot)algorithm.Results[ParetoFrontAnalysisResultName].Value).Rows["Test"];
    189199
    190200      // Delete solutions with higher rank, which are now dominated.
     
    194204          double quality = paretoFront[i][1];
    195205          if (quality <= currQuality) { // If existing solution is worse, delete it
    196             RemovePoint(plot, currRank);
     206            RemovePoint(plotTraining, currRank);
     207            RemovePoint(plotTest, currRank);
    197208            paretoFront.RemoveAt(i);
    198209          } else { // Otherwise stop, since following solutions can only be better
     
    205216
    206217      paretoFront.Insert(i, new DoubleArray(new double[] { currRank, currQuality }));
    207       plot.Points.Add(new Point2D<double>(currRank, currQuality, solution));
     218      plotTraining.Points.Add(new Point2D<double>(currRank, currQuality, solution));
     219      plotTest.Points.Add(new Point2D<double>(currRank, solution.TestRSquared, solution));
     220
    208221    }
    209222
Note: See TracChangeset for help on using the changeset viewer.