- Timestamp:
- 09/14/18 14:53:42 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/Analysis/BestSolutionAnalyzer.cs
r16090 r16142 47 47 public static readonly string ParetoFrontSolutionsResultName = "Pareto Front Solutions"; 48 48 49 public static readonly string ParetoFrontSolutionHistoryResultName = ""; 50 49 51 private static readonly ISymbolicDataAnalysisExpressionTreeInterpreter expressionTreeLinearInterpreter = new SymbolicDataAnalysisExpressionTreeLinearInterpreter(); 50 52 … … 109 111 ? GetValue<double>(results[BestTrainingQualityResultName].Value) 110 112 : 0.0; 113 bestR2 = double.IsNaN(bestR2) 114 ? 0.0 115 : bestR2; 116 111 117 var bestComplexity = results.ContainsKey(BestComplexityResultName) ? GetValue<int>(results[BestComplexityResultName].Value) : int.MaxValue; 112 118 var complexity = sentence.Complexity; … … 178 184 var scatterPlot = new ScatterPlot(ParetoFrontAnalysisResultName, ParetoFrontAnalysisResultName); 179 185 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>>())); 181 188 182 189 scatterPlot.VisualProperties.XAxisTitle = "Complexity"; 183 190 scatterPlot.VisualProperties.YAxisTitle = "R²"; 184 scatterPlot.Rows.First().VisualProperties.PointSize = 10; 191 foreach (ScatterPlotDataRow scatterPlotDataRow in scatterPlot.Rows) { 192 scatterPlotDataRow.VisualProperties.PointSize = 10; 193 } 185 194 } 186 195 187 196 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"]; 189 199 190 200 // Delete solutions with higher rank, which are now dominated. … … 194 204 double quality = paretoFront[i][1]; 195 205 if (quality <= currQuality) { // If existing solution is worse, delete it 196 RemovePoint(plot, currRank); 206 RemovePoint(plotTraining, currRank); 207 RemovePoint(plotTest, currRank); 197 208 paretoFront.RemoveAt(i); 198 209 } else { // Otherwise stop, since following solutions can only be better … … 205 216 206 217 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 208 221 } 209 222
Note: See TracChangeset
for help on using the changeset viewer.