Changeset 8430 for branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Views/3.4/TimeSeriesPrognosis
- Timestamp:
- 08/08/12 14:04:17 (13 years ago)
- Location:
- branches/HeuristicLab.TimeSeries
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.TimeSeries
- Property svn:ignore
-
old new 20 20 bin 21 21 protoc.exe 22 _ReSharper.HeuristicLab.TimeSeries-3.3
-
- Property svn:ignore
-
branches/HeuristicLab.TimeSeries/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/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.DataAnalysis.Views 7568-7810 /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/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Views/3.4/TimeSeriesPrognosis/TimeSeriesPrognosisSolutionLineChartView.cs
r8010 r8430 19 19 */ 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; … … 50 51 this.chart.CustomizeAllChartAreas(); 51 52 this.chart.ChartAreas[0].CursorX.IsUserSelectionEnabled = true; 53 this.chart.ChartAreas[0].CursorX.Interval = 1; 52 54 this.chart.ChartAreas[0].AxisX.ScaleView.Zoomable = true; 53 55 this.chart.ChartAreas[0].AxisX.IsStartedFromZero = true; 54 this.chart.ChartAreas[0].CursorX.Interval = 1;55 56 56 57 this.chart.ChartAreas[0].CursorY.IsUserSelectionEnabled = true; 58 this.chart.ChartAreas[0].CursorY.Interval = 0.1; 57 59 this.chart.ChartAreas[0].AxisY.ScaleView.Zoomable = true; 58 this.chart.ChartAreas[0].CursorY.Interval = 0; 60 61 this.chart.SuppressExceptions = false; 59 62 } 60 63 … … 69 72 this.chart.Series[TARGETVARIABLE_SERIES_NAME].LegendText = targetVariable; 70 73 this.chart.Series[TARGETVARIABLE_SERIES_NAME].ChartType = SeriesChartType.FastLine; 71 this.chart.Series[TARGETVARIABLE_SERIES_NAME].Points.DataBindXY(Enumerable.Range(0, Content.ProblemData.Dataset.Rows).ToArray(), 72 Content.ProblemData.Dataset.GetDoubleValues(targetVariable).ToArray()); 74 AddDataPoints(chart.Series[TARGETVARIABLE_SERIES_NAME].Points, Enumerable.Range(0, Content.ProblemData.Dataset.Rows), Content.ProblemData.Dataset.GetDoubleValues(targetVariable)); 75 //this.chart.Series[TARGETVARIABLE_SERIES_NAME].Points.DataBindXY(Enumerable.Range(0, Content.ProblemData.Dataset.Rows).ToArray(), 76 // Content.ProblemData.Dataset.GetDoubleValues(targetVariable).ToArray()); 73 77 74 78 this.chart.Series.Add(PROGNOSEDVALUES_TRAINING_SERIES_NAME); … … 76 80 this.chart.Series[PROGNOSEDVALUES_TRAINING_SERIES_NAME].ChartType = SeriesChartType.FastLine; 77 81 if (prognosedValuesCheckbox.Checked) { 78 this.chart.Series[PROGNOSEDVALUES_TRAINING_SERIES_NAME].Points 79 .DataBindXY(Content.ProblemData.TrainingIndizes.ToArray(), 80 Content.GetPrognosedValues(Content.ProblemData.TrainingIndizes.Take(1), Content.ProblemData.TrainingIndizes.Count().ToEnumerable()).First().ToArray()); 82 //this.chart.Series[PROGNOSEDVALUES_TRAINING_SERIES_NAME].Points 83 // .DataBindXY(Content.ProblemData.TrainingIndices.ToArray(), 84 // Content.GetPrognosedValues(Content.ProblemData.TrainingIndices.Take(1), Content.ProblemData.TrainingIndices.Count().ToEnumerable()).First().ToArray()); 85 AddDataPoints(chart.Series[PROGNOSEDVALUES_TRAINING_SERIES_NAME].Points, Content.ProblemData.TrainingIndices, Content.GetPrognosedValues(Content.ProblemData.TrainingIndices.Take(1), Content.ProblemData.TrainingIndices.Count().ToEnumerable()).First()); 81 86 } else { 82 this.chart.Series[PROGNOSEDVALUES_TRAINING_SERIES_NAME].Points 83 .DataBindXY(Content.ProblemData.TrainingIndizes.ToArray(), 84 Content.GetPrognosedValues(Content.ProblemData.TrainingIndizes, Enumerable.Repeat(1, Content.ProblemData.TrainingIndizes.Count())).SelectMany(x => x).ToArray()); 87 //this.chart.Series[PROGNOSEDVALUES_TRAINING_SERIES_NAME].Points 88 // .DataBindXY(Content.ProblemData.TrainingIndices.ToArray(), 89 // Content.GetPrognosedValues(Content.ProblemData.TrainingIndices, Enumerable.Repeat(1, Content.ProblemData.TrainingIndices.Count())).SelectMany(x => x).ToArray()); 90 AddDataPoints(chart.Series[PROGNOSEDVALUES_TRAINING_SERIES_NAME].Points, Content.ProblemData.TrainingIndices, Content.GetPrognosedValues(Content.ProblemData.TrainingIndices, Enumerable.Repeat(1, Content.ProblemData.TrainingIndices.Count())).SelectMany(x => x)); 85 91 } 86 92 this.chart.Series[PROGNOSEDVALUES_TRAINING_SERIES_NAME].Tag = Content; … … 94 100 this.chart.Series[PROGNOSEDVALUES_TEST_SERIES_NAME].ChartType = SeriesChartType.FastLine; 95 101 if (prognosedValuesCheckbox.Checked) { 96 this.chart.Series[PROGNOSEDVALUES_TEST_SERIES_NAME].Points 97 .DataBindXY(Content.ProblemData.TestIndizes.ToArray(), 98 Content.GetPrognosedValues(Content.ProblemData.TestIndizes.Take(1), Content.ProblemData.TestIndizes.Count().ToEnumerable()).First().ToArray()); 102 //this.chart.Series[PROGNOSEDVALUES_TEST_SERIES_NAME].Points 103 // .DataBindXY(Content.ProblemData.TestIndices.ToArray(), 104 // Content.GetPrognosedValues(Content.ProblemData.TestIndices.Take(1), Content.ProblemData.TestIndices.Count().ToEnumerable()).First().ToArray()); 105 AddDataPoints(chart.Series[PROGNOSEDVALUES_TEST_SERIES_NAME].Points, Content.ProblemData.TestIndices, Content.GetPrognosedValues(Content.ProblemData.TestIndices.Take(1), Content.ProblemData.TestIndices.Count().ToEnumerable()).First()); 99 106 } else { 100 this.chart.Series[PROGNOSEDVALUES_TEST_SERIES_NAME].Points 101 .DataBindXY(Content.ProblemData.TestIndizes.ToArray(), 102 Content.GetPrognosedValues(Content.ProblemData.TestIndizes, Enumerable.Repeat(1, Content.ProblemData.TestIndizes.Count())).SelectMany(x => x).ToArray()); 107 //this.chart.Series[PROGNOSEDVALUES_TEST_SERIES_NAME].Points 108 // .DataBindXY(Content.ProblemData.TestIndices.ToArray(), 109 // Content.GetPrognosedValues(Content.ProblemData.TestIndices, Enumerable.Repeat(1, Content.ProblemData.TestIndices.Count())).SelectMany(x => x).ToArray()); 110 AddDataPoints(chart.Series[PROGNOSEDVALUES_TEST_SERIES_NAME].Points, Content.ProblemData.TestIndices, Content.GetPrognosedValues(Content.ProblemData.TestIndices, Enumerable.Repeat(1, Content.ProblemData.TestIndices.Count())).SelectMany(x => x)); 103 111 } 104 112 this.chart.Series[PROGNOSEDVALUES_TEST_SERIES_NAME].Tag = Content; 105 106 113 UpdateCursorInterval(); 107 114 this.UpdateStripLines(); 115 } 116 chart.Refresh(); 117 } 118 119 private void AddDataPoints(DataPointCollection points, IEnumerable<int> xValues, IEnumerable<double> yValues) { 120 var xValuesEnumerator = xValues.GetEnumerator(); 121 var yValuesEnumerator = yValues.GetEnumerator(); 122 123 while (xValuesEnumerator.MoveNext() & yValuesEnumerator.MoveNext()) { 124 var xValue = xValuesEnumerator.Current; 125 var yValue = yValuesEnumerator.Current; 126 127 if (yValue < (double)decimal.MaxValue && yValue > (double)decimal.MinValue) { 128 DataPoint dataPoint = new DataPoint(xValue, yValue); 129 points.Add(dataPoint); 130 } 108 131 } 109 132 } … … 166 189 167 190 int[] attr = new int[Content.ProblemData.Dataset.Rows + 1]; // add a virtual last row that is again empty to simplify loop further down 168 foreach (var row in Content.ProblemData.TrainingIndi zes) {191 foreach (var row in Content.ProblemData.TrainingIndices) { 169 192 attr[row] += 1; 170 193 } 171 foreach (var row in Content.ProblemData.TestIndi zes) {194 foreach (var row in Content.ProblemData.TestIndices) { 172 195 attr[row] += 2; 173 196 } … … 215 238 } 216 239 } else if (Content != null) { 217 IEnumerable<int> indizes = null;240 IEnumerable<int> Indices = null; 218 241 IEnumerable<double> predictedValues = null; 219 242 220 243 switch (series.Name) { 221 244 case PROGNOSEDVALUES_TRAINING_SERIES_NAME: 222 indizes = Content.ProblemData.TrainingIndizes.ToArray();223 predictedValues = Content.GetPrognosedValues(Content.ProblemData.TrainingIndi zes.Take(1), Content.ProblemData.TrainingPartition.Size.ToEnumerable()).First();245 Indices = Content.ProblemData.TrainingIndices.ToArray(); 246 predictedValues = Content.GetPrognosedValues(Content.ProblemData.TrainingIndices.Take(1), Content.ProblemData.TrainingPartition.Size.ToEnumerable()).First(); 224 247 break; 225 248 case PROGNOSEDVALUES_TEST_SERIES_NAME: 226 249 testPrognosisStart = Content.ProblemData.TestPartition.Start; 227 indizes = Content.ProblemData.TestIndizes.ToArray();228 predictedValues = Content.GetPrognosedValues(Content.ProblemData.TestIndi zes.Take(1), Content.ProblemData.TestPartition.Size.ToEnumerable()).First();250 Indices = Content.ProblemData.TestIndices.ToArray(); 251 predictedValues = Content.GetPrognosedValues(Content.ProblemData.TestIndices.Take(1), Content.ProblemData.TestPartition.Size.ToEnumerable()).First(); 229 252 break; 230 253 } 231 series.Points.DataBindXY( indizes, predictedValues);254 series.Points.DataBindXY(Indices, predictedValues); 232 255 chart.DataManipulator.InsertEmptyPoints(1, IntervalType.Number, series.Name); 233 256 chart.Legends[series.Legend].ForeColor = Color.Black; … … 238 261 239 262 private void chart_MouseMove(object sender, MouseEventArgs e) { 240 HitTestResult result = chart.HitTest(e.X, e.Y);241 if (result.ChartElementType == ChartElementType.LegendItem && result.Series.Name != TARGETVARIABLE_SERIES_NAME)242 Cursor = Cursors.Hand;243 else244 Cursor = Cursors.Default;263 //HitTestResult result = chart.HitTest(e.X, e.Y); 264 //if (result.ChartElementType == ChartElementType.LegendItem && result.Series.Name != TARGETVARIABLE_SERIES_NAME) 265 // Cursor = Cursors.Hand; 266 //else 267 // Cursor = Cursors.Default; 245 268 } 246 269 247 270 private void chart_MouseDown(object sender, MouseEventArgs e) { 248 HitTestResult result = chart.HitTest(e.X, e.Y);249 if (result.ChartElementType == ChartElementType.LegendItem && result.Series.Name != TARGETVARIABLE_SERIES_NAME) {250 ToggleSeriesData(result.Series);251 } else if (result.ChartElementType == ChartElementType.Axis || result.ChartElementType == ChartElementType.AxisLabels ||252 result.ChartElementType == ChartElementType.TickMarks) {253 chart.ChartAreas[0].CursorX.SetCursorPixelPosition(new Point(e.X, e.Y), true);254 int pos = (int)Math.Round(chart.ChartAreas[0].CursorX.Position);255 if (pos >= Content.ProblemData.TestPartition.Start && pos < Content.ProblemData.TestPartition.End) {256 testPrognosisStart = pos;257 RedrawChart();258 }259 }271 //HitTestResult result = chart.HitTest(e.X, e.Y); 272 //if (result.ChartElementType == ChartElementType.LegendItem && result.Series.Name != TARGETVARIABLE_SERIES_NAME) { 273 // ToggleSeriesData(result.Series); 274 //} else if (result.ChartElementType == ChartElementType.Axis || result.ChartElementType == ChartElementType.AxisLabels || 275 // result.ChartElementType == ChartElementType.TickMarks) { 276 // chart.ChartAreas[0].CursorX.SetCursorPixelPosition(new Point(e.X, e.Y), true); 277 // int pos = (int)Math.Round(chart.ChartAreas[0].CursorX.Position); 278 // if (pos >= Content.ProblemData.TestPartition.Start && pos < Content.ProblemData.TestPartition.End) { 279 // testPrognosisStart = pos; 280 // RedrawChart(); 281 // } 282 //} 260 283 } 261 284 -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Views/3.4/TimeSeriesPrognosis/TimeSeriesPrognosisSolutionPrognosedValuesView.cs
r8010 r8430 95 95 96 96 string[,] values = new string[Content.ProblemData.Dataset.Rows, 4]; 97 var prognosedTraining = Content.GetPrognosedValues(Content.ProblemData.TrainingIndi zes.Take(1), Content.ProblemData.TrainingPartition.Size.ToEnumerable()).First();98 var prognosedTest = Content.GetPrognosedValues(Content.ProblemData.TestIndi zes.Take(1), Content.ProblemData.TestPartition.Size.ToEnumerable()).First();97 var prognosedTraining = Content.GetPrognosedValues(Content.ProblemData.TrainingIndices.Take(1), Content.ProblemData.TrainingPartition.Size.ToEnumerable()).First(); 98 var prognosedTest = Content.GetPrognosedValues(Content.ProblemData.TestIndices.Take(1), Content.ProblemData.TestPartition.Size.ToEnumerable()).First(); 99 99 double[] target = Content.ProblemData.Dataset.GetDoubleValues(targetVariable).ToArray(); 100 100 … … 105 105 } 106 106 107 var rowsEnumerator = Content.ProblemData.TrainingIndi zes.GetEnumerator();107 var rowsEnumerator = Content.ProblemData.TrainingIndices.GetEnumerator(); 108 108 var prognosisEnumerator = prognosedTraining.GetEnumerator(); 109 109 while (rowsEnumerator.MoveNext() & prognosisEnumerator.MoveNext()) { … … 113 113 } 114 114 115 rowsEnumerator = Content.ProblemData.TestIndi zes.GetEnumerator();115 rowsEnumerator = Content.ProblemData.TestIndices.GetEnumerator(); 116 116 prognosisEnumerator = prognosedTest.GetEnumerator(); 117 117 while (rowsEnumerator.MoveNext() & prognosisEnumerator.MoveNext()) {
Note: See TracChangeset
for help on using the changeset viewer.