Changeset 8032 for branches/ChangeDatasetOfRegressionModel/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression
- Timestamp:
- 06/18/12 11:18:51 (12 years ago)
- Location:
- branches/ChangeDatasetOfRegressionModel/HeuristicLab.Problems.DataAnalysis.Views
- Files:
-
- 8 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/ChangeDatasetOfRegressionModel/HeuristicLab.Problems.DataAnalysis.Views
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
/branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Views merged eligible /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.DataAnalysis.Views merged eligible /trunk/sources/HeuristicLab.Problems.DataAnalysis.Views merged eligible /branches/Benchmarking/sources/HeuristicLab.Problems.DataAnalysis.Views 6917-7005 /branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Views 4656-4721 /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Views 5471-5808 /branches/DataAnalysis SolutionEnsembles/HeuristicLab.Problems.DataAnalysis.Views 5815-6180 /branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Views 6284-6795 /branches/NET40/sources/HeuristicLab.Problems.DataAnalysis.Views 5138-5162 /branches/ParallelEngine/HeuristicLab.Problems.DataAnalysis.Views 5175-5192 /branches/QAPAlgorithms/HeuristicLab.Problems.DataAnalysis.Views 6350-6627 /branches/Restructure trunk solution/HeuristicLab.Problems.DataAnalysis.Views 6828 /branches/SuccessProgressAnalysis/HeuristicLab.Problems.DataAnalysis.Views 5370-5682 /branches/Trunk/HeuristicLab.Problems.DataAnalysis.Views 6829-6865 /branches/VNS/HeuristicLab.Problems.DataAnalysis.Views 5594-5752 /branches/histogram/HeuristicLab.Problems.DataAnalysis.Views 5959-6341
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
-
branches/ChangeDatasetOfRegressionModel/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionEnsembleSolutionModelView.Designer.cs
r7259 r8032 50 50 // 51 51 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 52 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode. Font;52 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 53 53 this.Name = "RegressionEnsembleSolutionModelView"; 54 54 this.ResumeLayout(false); -
branches/ChangeDatasetOfRegressionModel/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionErrorCharacteristicsCurveView.Designer.cs
r7043 r8032 49 49 this.chart.TabIndex = 0; 50 50 this.chart.Text = "chart"; 51 this.chart.MouseDown += new System.Windows.Forms.MouseEventHandler(this.chart_MouseDown); 51 this.chart.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.Chart_MouseDoubleClick); 52 this.chart.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart_MouseMove); 52 53 // 53 54 // label1 … … 73 74 // 74 75 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 75 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode. Font;76 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 76 77 this.Controls.Add(this.label1); 77 78 this.Controls.Add(this.cmbSamples); -
branches/ChangeDatasetOfRegressionModel/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionErrorCharacteristicsCurveView.cs
r7259 r8032 27 27 using HeuristicLab.MainForm; 28 28 using HeuristicLab.MainForm.WindowsForms; 29 29 30 namespace HeuristicLab.Problems.DataAnalysis.Views { 30 31 [View("Error Characteristics Curve")] … … 104 105 var originalValues = GetOriginalValues().ToList(); 105 106 constantModel = CreateConstantModel(); 106 var meanModelEstimatedValues = GetEstimatedValues(constantModel);107 var meanModelResiduals = GetResiduals(originalValues, meanModelEstimatedValues);108 109 meanModelResiduals.Sort();110 chart.ChartAreas[0].AxisX.Maximum = Math.Ceiling( meanModelResiduals.Last());111 chart.ChartAreas[0].CursorX.Interval = meanModelResiduals.First() / 100;112 113 Series meanModelSeries = new Series("Mean Model");114 meanModelSeries.ChartType = SeriesChartType.FastLine;115 UpdateSeries( meanModelResiduals, meanModelSeries);116 meanModelSeries.ToolTip = "Area over Curve: " + CalculateAreaOverCurve(meanModelSeries);117 meanModelSeries.Tag = constantModel;118 chart.Series.Add( meanModelSeries);107 var baselineEstimatedValues = GetEstimatedValues(constantModel); 108 var baselineResiduals = GetResiduals(originalValues, baselineEstimatedValues); 109 110 baselineResiduals.Sort(); 111 chart.ChartAreas[0].AxisX.Maximum = Math.Ceiling(baselineResiduals.Last()); 112 chart.ChartAreas[0].CursorX.Interval = baselineResiduals.First() / 100; 113 114 Series baselineSeries = new Series("Baseline"); 115 baselineSeries.ChartType = SeriesChartType.FastLine; 116 UpdateSeries(baselineResiduals, baselineSeries); 117 baselineSeries.ToolTip = "Area over Curve: " + CalculateAreaOverCurve(baselineSeries); 118 baselineSeries.Tag = constantModel; 119 chart.Series.Add(baselineSeries); 119 120 120 121 AddRegressionSolution(Content); … … 200 201 } 201 202 202 protected IEnumerable<double> Get MeanModelEstimatedValues(IEnumerable<double> originalValues) {203 protected IEnumerable<double> GetbaselineEstimatedValues(IEnumerable<double> originalValues) { 203 204 double averageTrainingTarget = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes).Average(); 204 205 return Enumerable.Repeat(averageTrainingTarget, originalValues.Count()); … … 229 230 } 230 231 231 #region Mean Model 232 private void chart_MouseDown(object sender, MouseEventArgs e) { 233 if (e.Clicks < 2) return; 232 #region Baseline 233 private void Chart_MouseDoubleClick(object sender, MouseEventArgs e) { 234 234 HitTestResult result = chart.HitTest(e.X, e.Y); 235 235 if (result.ChartElementType != ChartElementType.LegendItem) return; 236 if (result.Series.Name != constantModel.Name) return;237 236 238 237 MainFormManager.MainForm.ShowContent((IRegressionSolution)result.Series.Tag); … … 242 241 double averageTrainingTarget = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes).Average(); 243 242 var solution = new ConstantRegressionModel(averageTrainingTarget).CreateRegressionSolution(ProblemData); 244 solution.Name = " Mean Model";243 solution.Name = "Baseline"; 245 244 return solution; 246 245 } 247 246 #endregion 247 248 private void chart_MouseMove(object sender, MouseEventArgs e) { 249 HitTestResult result = chart.HitTest(e.X, e.Y); 250 if (result.ChartElementType == ChartElementType.LegendItem) 251 Cursor = Cursors.Hand; 252 else 253 Cursor = Cursors.Default; 254 } 248 255 } 249 256 } -
branches/ChangeDatasetOfRegressionModel/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionEstimatedValuesView.Designer.cs
r7259 r8032 50 50 this.AllowDrop = true; 51 51 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 52 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode. Font;52 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 53 53 this.Name = "EstimatedValuesView"; 54 54 this.Size = new System.Drawing.Size(310, 285); -
branches/ChangeDatasetOfRegressionModel/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionLineChartView.Designer.cs
r7259 r8032 72 72 this.AllowDrop = true; 73 73 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 74 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode. Font;74 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 75 75 this.Controls.Add(this.chart); 76 76 this.Name = "RegressionSolutionLineChartView"; -
branches/ChangeDatasetOfRegressionModel/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionLineChartView.cs
r7327 r8032 26 26 using System.Windows.Forms.DataVisualization.Charting; 27 27 using HeuristicLab.MainForm; 28 using HeuristicLab.MainForm.WindowsForms;29 28 30 29 namespace HeuristicLab.Problems.DataAnalysis.Views { … … 72 71 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].LegendText = ESTIMATEDVALUES_TRAINING_SERIES_NAME; 73 72 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].ChartType = SeriesChartType.FastLine; 73 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].EmptyPointStyle.Color = this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Color; 74 74 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TrainingIndizes.ToArray(), Content.EstimatedTrainingValues.ToArray()); 75 this.InsertEmptyPoints(this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME]); 75 76 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Tag = Content; 76 77 // test series … … 79 80 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].ChartType = SeriesChartType.FastLine; 80 81 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TestIndizes.ToArray(), Content.EstimatedTestValues.ToArray()); 82 this.InsertEmptyPoints(this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME]); 81 83 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Tag = Content; 82 84 // series of remaining points … … 84 86 var estimatedValues = Content.EstimatedValues.ToArray(); 85 87 List<double> allEstimatedValues = allIndizes.Select(index => estimatedValues[index]).ToList(); 86 87 88 this.chart.Series.Add(ESTIMATEDVALUES_ALL_SERIES_NAME); 88 89 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].LegendText = ESTIMATEDVALUES_ALL_SERIES_NAME; 89 90 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].ChartType = SeriesChartType.FastLine; 90 91 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Points.DataBindXY(allIndizes, allEstimatedValues); 92 this.InsertEmptyPoints(this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME]); 91 93 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Tag = Content; 92 94 this.ToggleSeriesData(this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME]); … … 94 96 UpdateCursorInterval(); 95 97 this.UpdateStripLines(); 98 } 99 } 100 101 private void InsertEmptyPoints(Series series) { 102 int i = 0; 103 while (i < series.Points.Count - 1) { 104 if (series.Points[i].IsEmpty) { 105 ++i; 106 continue; 107 } 108 109 var p1 = series.Points[i]; 110 var p2 = series.Points[i + 1]; 111 // check for consecutive indices 112 if ((int)p2.XValue - (int)p1.XValue != 1) { 113 // insert an empty point between p1 and p2 so that the line will be invisible (transparent) 114 var p = new DataPoint((int)((p1.XValue + p2.XValue) / 2), 0.0) { IsEmpty = true }; 115 series.Points.Insert(i + 1, p); 116 } 117 ++i; 96 118 } 97 119 } … … 196 218 if (series.Points.Count > 0) { //checks if series is shown 197 219 if (this.chart.Series.Any(s => s != series && s.Points.Count > 0)) { 198 series.Points.Clear();220 ClearPointsQuick(series.Points); 199 221 } 200 222 } else if (Content != null) { … … 219 241 } 220 242 series.Points.DataBindXY(indizes, predictedValues); 221 chart.DataManipulator.InsertEmptyPoints(1, IntervalType.Number, series.Name);243 this.InsertEmptyPoints(series); 222 244 chart.Legends[series.Legend].ForeColor = Color.Black; 223 245 UpdateCursorInterval(); 224 246 chart.Refresh(); 225 247 } 248 } 249 250 // workaround as per http://stackoverflow.com/questions/5744930/datapointcollection-clear-performance 251 private static void ClearPointsQuick(DataPointCollection points) { 252 points.SuspendUpdates(); 253 while (points.Count > 0) 254 points.RemoveAt(points.Count - 1); 255 points.ResumeUpdates(); 226 256 } 227 257 -
branches/ChangeDatasetOfRegressionModel/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionScatterPlotView.cs
r7259 r8032 119 119 this.chart.ChartAreas[0].CursorX.Interval = zoomInterval; 120 120 this.chart.ChartAreas[0].CursorY.Interval = zoomInterval; 121 122 this.chart.ChartAreas[0].AxisX.ScaleView.SmallScrollSize = zoomInterval; 123 this.chart.ChartAreas[0].AxisY.ScaleView.SmallScrollSize = zoomInterval; 124 125 this.chart.ChartAreas[0].AxisX.ScaleView.SmallScrollMinSizeType = DateTimeIntervalType.Number; 126 this.chart.ChartAreas[0].AxisX.ScaleView.SmallScrollMinSize = zoomInterval; 127 this.chart.ChartAreas[0].AxisY.ScaleView.SmallScrollMinSizeType = DateTimeIntervalType.Number; 128 this.chart.ChartAreas[0].AxisY.ScaleView.SmallScrollMinSize = zoomInterval; 129 130 if (digits < 0) { 131 this.chart.ChartAreas[0].AxisX.LabelStyle.Format = "F" + (int)Math.Abs(digits); 132 this.chart.ChartAreas[0].AxisY.LabelStyle.Format = "F" + (int)Math.Abs(digits); 133 } else { 134 this.chart.ChartAreas[0].AxisX.LabelStyle.Format = "F0"; 135 this.chart.ChartAreas[0].AxisY.LabelStyle.Format = "F0"; 136 } 121 137 } 122 138
Note: See TracChangeset
for help on using the changeset viewer.