Changeset 12668
- Timestamp:
- 07/08/15 09:51:05 (9 years ago)
- Location:
- stable
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 12493,12577,12642
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis.Views
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Views merged: 12493,12577,12642
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionErrorCharacteristicsCurveView.Designer.cs
r12009 r12668 46 46 private void InitializeComponent() { 47 47 this.components = new System.ComponentModel.Container(); 48 System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea 1= new System.Windows.Forms.DataVisualization.Charting.ChartArea();49 System.Windows.Forms.DataVisualization.Charting.Legend legend 1= new System.Windows.Forms.DataVisualization.Charting.Legend();48 System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); 49 System.Windows.Forms.DataVisualization.Charting.Legend legend2 = new System.Windows.Forms.DataVisualization.Charting.Legend(); 50 50 this.chart = new HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart(); 51 51 this.label1 = new System.Windows.Forms.Label(); 52 52 this.cmbSamples = new System.Windows.Forms.ComboBox(); 53 this.residualComboBox = new System.Windows.Forms.ComboBox(); 53 54 ((System.ComponentModel.ISupportInitialize)(this.chart)).BeginInit(); 54 55 this.SuspendLayout(); … … 56 57 // chart 57 58 // 58 this.chart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 59 | System.Windows.Forms.AnchorStyles.Left)60 61 chartArea 1.Name = "ChartArea1";62 this.chart.ChartAreas.Add(chartArea 1);63 legend 1.Alignment = System.Drawing.StringAlignment.Center;64 legend 1.Docking = System.Windows.Forms.DataVisualization.Charting.Docking.Top;65 legend 1.Name = "Legend1";66 this.chart.Legends.Add(legend 1);59 this.chart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 60 | System.Windows.Forms.AnchorStyles.Left) 61 | System.Windows.Forms.AnchorStyles.Right))); 62 chartArea2.Name = "ChartArea1"; 63 this.chart.ChartAreas.Add(chartArea2); 64 legend2.Alignment = System.Drawing.StringAlignment.Center; 65 legend2.Docking = System.Windows.Forms.DataVisualization.Charting.Docking.Top; 66 legend2.Name = "Legend1"; 67 this.chart.Legends.Add(legend2); 67 68 this.chart.Location = new System.Drawing.Point(6, 28); 68 69 this.chart.Name = "chart"; … … 92 93 this.cmbSamples.SelectedIndexChanged += new System.EventHandler(this.cmbSamples_SelectedIndexChanged); 93 94 // 95 // residualComboBox 96 // 97 this.residualComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 98 this.residualComboBox.FormattingEnabled = true; 99 this.residualComboBox.Items.AddRange(new object[] { 100 "Absolute error", 101 "Squared error", 102 "Relative error"}); 103 this.residualComboBox.Location = new System.Drawing.Point(183, 3); 104 this.residualComboBox.Name = "residualComboBox"; 105 this.residualComboBox.Size = new System.Drawing.Size(121, 21); 106 this.residualComboBox.TabIndex = 5; 107 this.residualComboBox.SelectedIndexChanged += new System.EventHandler(this.residualComboBox_SelectedIndexChanged); 108 // 94 109 // RegressionSolutionErrorCharacteristicsCurveView 95 110 // 96 111 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 112 this.Controls.Add(this.residualComboBox); 97 113 this.Controls.Add(this.label1); 98 114 this.Controls.Add(this.cmbSamples); … … 111 127 protected System.Windows.Forms.Label label1; 112 128 protected System.Windows.Forms.ComboBox cmbSamples; 129 protected System.Windows.Forms.ComboBox residualComboBox; 113 130 } 114 131 } -
stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionErrorCharacteristicsCurveView.cs
r12385 r12668 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; … … 99 102 chart.Series.Clear(); 100 103 chart.Annotations.Clear(); 104 chart.ChartAreas[0].AxisX.Maximum = 0.0; 105 chart.ChartAreas[0].CursorX.Interval = 0.01; 101 106 102 107 if (Content == null) return; … … 109 114 110 115 AddRegressionSolution(Content); 116 117 chart.ChartAreas[0].AxisX.Title = residualComboBox.SelectedItem.ToString(); 111 118 } 112 119 … … 118 125 solutionSeries.ChartType = SeriesChartType.FastLine; 119 126 var residuals = GetResiduals(GetOriginalValues(), GetEstimatedValues(solution)); 120 121 127 122 128 var maxValue = residuals.Max(); … … 125 131 var maximum = scale * (1 + (int)(maxValue / scale)); 126 132 chart.ChartAreas[0].AxisX.Maximum = maximum; 127 }128 chart.ChartAreas[0].CursorX.Interval = residuals.Min() / 100;133 chart.ChartAreas[0].CursorX.Interval = residuals.Min() / 100; 134 } 129 135 130 136 UpdateSeries(residuals, solutionSeries); … … 203 209 204 210 protected virtual List<double> GetResiduals(IEnumerable<double> originalValues, IEnumerable<double> estimatedValues) { 205 return originalValues.Zip(estimatedValues, (x, y) => Math.Abs(x - y)).ToList(); 211 switch (residualComboBox.SelectedItem.ToString()) { 212 case "Absolute error": return originalValues.Zip(estimatedValues, (x, y) => Math.Abs(x - y)).ToList(); 213 case "Squared error": return originalValues.Zip(estimatedValues, (x, y) => (x - y) * (x - y)).ToList(); 214 case "Relative error": return originalValues.Zip(estimatedValues, (x, y) => x.IsAlmost(0.0) ? -1 : Math.Abs((x - y) / x)) 215 .Where(x => x > 0) // remove entries where the original value is 0 216 .ToList(); 217 default: throw new NotSupportedException(); 218 } 206 219 } 207 220 … … 251 264 } 252 265 } 266 267 private void residualComboBox_SelectedIndexChanged(object sender, EventArgs e) { 268 UpdateChart(); 269 } 253 270 } 254 271 }
Note: See TracChangeset
for help on using the changeset viewer.