Changeset 12505 for branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionErrorCharacteristicsCurveView.cs
- Timestamp:
- 06/25/15 11:26:25 (9 years ago)
- Location:
- branches/HeuristicLab.DatasetRefactor/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.DatasetRefactor/sources
- Property svn:mergeinfo changed
/trunk/sources merged: 12442-12443,12445,12455-12458,12461,12463-12465,12470-12476,12478-12482,12485,12488,12490-12494,12496-12497,12504 -
Property
svn:global-ignores
set to
*.nuget
packages
- Property svn:mergeinfo changed
-
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Problems.DataAnalysis.Views
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Views merged: 12493
- Property svn:mergeinfo changed
-
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionErrorCharacteristicsCurveView.cs
r12438 r12505 25 25 using System.Windows.Forms; 26 26 using System.Windows.Forms.DataVisualization.Charting; 27 using HeuristicLab.Common; 27 28 using HeuristicLab.MainForm; 28 29 … … 45 46 cmbSamples.SelectedIndex = 0; 46 47 48 residualComboBox.SelectedIndex = 0; 49 47 50 chart.CustomizeAllChartAreas(); 48 chart.ChartAreas[0].AxisX.Title = "Absolute Error";51 chart.ChartAreas[0].AxisX.Title = residualComboBox.SelectedItem.ToString(); 49 52 chart.ChartAreas[0].AxisX.Minimum = 0.0; 50 53 chart.ChartAreas[0].AxisX.Maximum = 0.0; … … 109 112 110 113 AddRegressionSolution(Content); 114 115 chart.ChartAreas[0].AxisX.Title = residualComboBox.SelectedItem.ToString(); 111 116 } 112 117 … … 119 124 var residuals = GetResiduals(GetOriginalValues(), GetEstimatedValues(solution)); 120 125 121 122 126 var maxValue = residuals.Max(); 123 if (maxValue >= chart.ChartAreas[0].AxisX.Maximum) { 124 double scale = Math.Pow(10, Math.Floor(Math.Log10(maxValue))); 125 var maximum = scale * (1 + (int)(maxValue / scale)); 126 chart.ChartAreas[0].AxisX.Maximum = maximum; 127 } 127 double scale = Math.Pow(10, Math.Floor(Math.Log10(maxValue))); 128 var maximum = scale * (1 + (int)(maxValue / scale)); 129 chart.ChartAreas[0].AxisX.Maximum = maximum; 128 130 chart.ChartAreas[0].CursorX.Interval = residuals.Min() / 100; 129 131 … … 203 205 204 206 protected virtual List<double> GetResiduals(IEnumerable<double> originalValues, IEnumerable<double> estimatedValues) { 205 return originalValues.Zip(estimatedValues, (x, y) => Math.Abs(x - y)).ToList(); 207 switch (residualComboBox.SelectedItem.ToString()) { 208 case "Absolute error": return originalValues.Zip(estimatedValues, (x, y) => Math.Abs(x - y)).ToList(); 209 case "Squared error": return originalValues.Zip(estimatedValues, (x, y) => (x - y) * (x - y)).ToList(); 210 case "Relative error": return originalValues.Zip(estimatedValues, (x, y) => x.IsAlmost(0.0) ? -1 : Math.Abs((x - y) / x)) 211 .Where(x => x > 0) // remove entries where the original value is 0 212 .ToList(); 213 } 214 // should never happen 215 return new List<double>(); 206 216 } 207 217 … … 251 261 } 252 262 } 263 264 private void residualComboBox_SelectedIndexChanged(object sender, EventArgs e) { 265 UpdateChart(); 266 } 253 267 } 254 268 }
Note: See TracChangeset
for help on using the changeset viewer.