Changeset 9252
- Timestamp:
- 02/27/13 21:55:18 (12 years ago)
- Location:
- branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/CrossoverPerformanceAnalyzer.cs
r9210 r9252 133 133 Parameters.Add(new LookupParameter<DoubleValue>("WorstKnownQuality", "The quality of the worst known solution of this problem.")); 134 134 135 worseParentCrossoverPerformancePlot = new ScatterPlotHelper(false, true, true );136 betterParentCrossoverPerformancePlot = new ScatterPlotHelper(false, true, true );137 childDiversityToWorseParentHelper = new ScatterPlotHelper(false, true );138 childDiversityToBetterParentHelper = new ScatterPlotHelper(false, true );139 unwantedMutationsHelper = new ScatterPlotHelper(false, true );140 parentDiversityHelper = new ScatterPlotHelper(false, true );141 parentQualityHelper = new ScatterPlotHelper(false, true, true );135 worseParentCrossoverPerformancePlot = new ScatterPlotHelper(false, true, true, true); 136 betterParentCrossoverPerformancePlot = new ScatterPlotHelper(false, true, true, true); 137 childDiversityToWorseParentHelper = new ScatterPlotHelper(false, true, false, true); 138 childDiversityToBetterParentHelper = new ScatterPlotHelper(false, true, false, true); 139 unwantedMutationsHelper = new ScatterPlotHelper(false, true, false, true); 140 parentDiversityHelper = new ScatterPlotHelper(false, true, false, true); 141 parentQualityHelper = new ScatterPlotHelper(false, true, true, true); 142 142 successHelper = new DataTableHelper(); 143 143 equalParentsHelper = new DataTableHelper(); … … 320 320 parentQualityHelper.CleanUp(); 321 321 unwantedMutationsHelper.CleanUp(); 322 successHelper.CleanUpAndCompressData(); 323 equalParentsHelper.CleanUpAndCompressData(); 322 324 } 323 325 } -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/DataTableHelper.cs
r9059 r9252 20 20 #endregion 21 21 22 using System.Linq; 22 23 using HeuristicLab.Collections; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 26 using HeuristicLab.Data; 25 27 using HeuristicLab.Optimization; 26 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 79 81 return dt.Rows[dataRowNames[0]].Values; 80 82 } 83 84 public void CleanUp() { 85 //remove chart 86 resultsCol[chartName].Value = null; 87 resultsCol.Remove(chartName); 88 dt = null; 89 } 90 91 public void CleanUpAndCompressData() { 92 string[] columnNames = new string[] { "Count", "Minimum", "Maximum", "Average", "Median", "Standard Deviation", "Variance", "25th Percentile", "75th Percentile", "Gradient", "Relative Error", "Avg. of Upper 25 %", " Avg. of Lower 25 %", "Avg. of First 25 %", "Avg. of Last 25 %" }; 93 94 foreach (string rowName in dataRowNames) { 95 DataRow curDataRow = dt.Rows[rowName]; 96 var values = curDataRow.Values.AsEnumerable(); 97 98 double cnt = values.Count(); 99 double min = values.Min(); 100 double max = values.Max(); 101 double avg = values.Average(); 102 double median = values.Median(); 103 double stdDev = values.StandardDeviation(); 104 double variance = values.Variance(); 105 double percentile25 = values.Percentile(0.25); 106 double percentile75 = values.Percentile(0.75); 107 double k, d, r; 108 LinearLeastSquaresFitting.Calculate(values.ToArray(), out k, out d); 109 r = LinearLeastSquaresFitting.CalculateError(values.ToArray(), k, d); 110 double lowerAvg = values.OrderBy(x => x).Take((int)(values.Count() * 0.25)).Average(); 111 double upperAvg = values.OrderByDescending(x => x).Take((int)(values.Count() * 0.25)).Average(); 112 double firstAvg = values.Take((int)(values.Count() * 0.25)).Average(); 113 double lastAvg = values.Skip((int)(values.Count() * 0.75)).Average(); 114 115 resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[0], new DoubleValue(cnt))); 116 resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[1], new DoubleValue(min))); 117 resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[2], new DoubleValue(max))); 118 resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[3], new DoubleValue(avg))); 119 resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[4], new DoubleValue(median))); 120 resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[5], new DoubleValue(stdDev))); 121 resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[6], new DoubleValue(variance))); 122 resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[7], new DoubleValue(percentile25))); 123 resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[8], new DoubleValue(percentile75))); 124 resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[9], new DoubleValue(k))); 125 resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[10], new DoubleValue(r))); 126 resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[11], new DoubleValue(upperAvg))); 127 resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[12], new DoubleValue(lowerAvg))); 128 resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[13], new DoubleValue(firstAvg))); 129 resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[14], new DoubleValue(lastAvg))); 130 } 131 132 CleanUp(); 133 } 81 134 } 82 135 } -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/MutationPerformanceAnalyzer.cs
r9185 r9252 120 120 Parameters.Add(new LookupParameter<DoubleValue>("WorstKnownQuality", "The quality of the worst known solution of this problem.")); 121 121 122 diversityPlotHelper = new ScatterPlotHelper(false, true );123 qualityPlotHelper = new ScatterPlotHelper(false, true, true );122 diversityPlotHelper = new ScatterPlotHelper(false, true, false, true); 123 qualityPlotHelper = new ScatterPlotHelper(false, true, true, true); 124 124 successHelper = new DataTableHelper(); 125 125 } … … 203 203 qualityPlotHelper.CleanUp(); 204 204 diversityPlotHelper.CleanUp(); 205 successHelper.CleanUpAndCompressData(); 205 206 } 206 207 -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/ScatterPlotHelper.cs
r9185 r9252 51 51 private bool trackMinMaxValues; 52 52 [Storable] 53 private bool compressData; 54 [Storable] 53 55 private double min; 54 56 public double Min { … … 81 83 min = original.min; 82 84 max = original.max; 85 compressData = original.compressData; 83 86 84 87 chartName = original.chartName; … … 94 97 min = double.MaxValue; 95 98 max = double.MinValue; 99 compressData = false; 96 100 } 97 101 98 public ScatterPlotHelper(bool storeHistory, bool createDataTable, bool trackMinMax = false )102 public ScatterPlotHelper(bool storeHistory, bool createDataTable, bool trackMinMax = false, bool compress = false) 99 103 : base() { 100 104 StoreHistory = storeHistory; 101 105 CreateDataTable = createDataTable; 102 106 trackMinMaxValues = trackMinMax; 107 compressData = compress; 103 108 min = double.MaxValue; 104 109 max = double.MinValue; … … 170 175 minMaxDataTableHelper.InitializeChart(Results, chartName + " Scaled Chart", new string[] { yAxisTitle }); 171 176 dataTableHelper.GetFirstDataRow().ForEach(x => minMaxDataTableHelper.AddPoint((x - min) / (max - min))); 177 178 dataTableHelper.CleanUp(); //just use the scaled chart and remove the original 179 180 if (compressData) { 181 minMaxDataTableHelper.CleanUpAndCompressData(); 182 } 183 } 184 185 if (CreateDataTable && compressData && !trackMinMaxValues) { 186 dataTableHelper.CleanUpAndCompressData(); 172 187 } 173 188 -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/SolutionToPopulationAnalyzer.cs
r9196 r9252 108 108 Parameters.Add(new LookupParameter<DoubleValue>("WorstKnownQuality", "The quality of the worst known solution of this problem.")); 109 109 110 populationDiversityPlot = new ScatterPlotHelper(false, true );111 populationQualityPlot = new ScatterPlotHelper(false, true, true );112 qualityPlot = new ScatterPlotHelper(false, true, true );110 populationDiversityPlot = new ScatterPlotHelper(false, true, false, true); 111 populationQualityPlot = new ScatterPlotHelper(false, true, true, true); 112 qualityPlot = new ScatterPlotHelper(false, true, true, true); 113 113 } 114 114
Note: See TracChangeset
for help on using the changeset viewer.