Changeset 7100 for branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Views/3.4/TimeSeriesPrognosis
- Timestamp:
- 11/29/11 20:05:38 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Views/3.4/TimeSeriesPrognosis/TimeSeriesPrognosisSolutionPrognosedValuesView.cs
r6802 r7100 20 20 #endregion 21 21 using System; 22 using System.Collections.Generic; 22 23 using System.Linq; 23 24 using System.Windows.Forms; … … 32 33 public partial class TimeSeriesPrognosisSolutionEstimatedValuesView : DataAnalysisSolutionEvaluationView { 33 34 private const string TARGETVARIABLE_SERIES_NAME = "Target Variable"; 34 private const string PROGNOSEDVALUES_SERIES_NAME = "Prognosed Values (all)";35 35 private const string PROGNOSEDVALUES_TRAINING_SERIES_NAME = "Prognosed Values (training)"; 36 36 private const string PROGNOSEDVALUES_TEST_SERIES_NAME = "Prognosed Values (test)"; … … 85 85 else { 86 86 StringMatrix matrix = null; 87 List<string> columnNames = new List<string>(); 87 88 if (Content != null) { 88 string[,] values = new string[Content.ProblemData.Dataset.Rows, 7];89 columnNames.Add("Id"); 89 90 90 double[] target = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable).ToArray(); 91 var prognosed = Content.PrognosedValues.GetEnumerator(); 92 var prognosed_training = Content.PrognosedTrainingValues.GetEnumerator(); 93 var prognosed_test = Content.PrognosedTestValues.GetEnumerator(); 91 string[,] values = new string[Content.ProblemData.Dataset.Rows, 1 + 3 * Content.ProblemData.TargetVariables.Count()]; 92 foreach (var row in Enumerable.Range(0, Content.ProblemData.Dataset.Rows)) 93 values[row, 0] = row.ToString(); 94 94 95 foreach (var row in Content.ProblemData.TrainingIndizes) { 96 prognosed_training.MoveNext(); 97 values[row, 3] = prognosed_training.Current.ToString(); 98 } 95 var prognosedTraining = Content.PrognosedTrainingValues.ToArray(); 96 var prognosedTest = Content.PrognosedTestValues.ToArray(); 99 97 100 foreach (var row in Content.ProblemData.TestIndizes) {101 prognosed_test.MoveNext();102 values[row, 4] = prognosed_test.Current.ToString();103 }98 int i = 0; 99 int targetVariableIndex = 0; 100 foreach (var targetVariable in Content.ProblemData.TargetVariables) { 101 double[] target = Content.ProblemData.Dataset.GetDoubleValues(targetVariable).ToArray(); 104 102 105 foreach (var row in Enumerable.Range(0, Content.ProblemData.Dataset.Rows)) { 106 prognosed.MoveNext(); 107 double est = prognosed.Current; 108 double res = Math.Abs(est - target[row]); 109 values[row, 0] = row.ToString(); 110 values[row, 1] = target[row].ToString(); 111 values[row, 2] = est.ToString(); 112 values[row, 5] = Math.Abs(res).ToString(); 113 values[row, 6] = Math.Abs(res / est).ToString(); 114 } 103 var prognosedTrainingEnumerator = prognosedTraining[targetVariableIndex].GetEnumerator(); 104 foreach (var row in Content.ProblemData.TrainingIndizes) { 105 prognosedTrainingEnumerator.MoveNext(); 106 values[row, i + 2] = prognosedTrainingEnumerator.Current.ToString(); 107 } 108 109 var prognosedTestEnumerator = prognosedTest[targetVariableIndex].GetEnumerator(); 110 foreach (var row in Content.ProblemData.TestIndizes) { 111 prognosedTestEnumerator.MoveNext(); 112 values[row, i + 3] = prognosedTestEnumerator.Current.ToString(); 113 } 114 115 foreach (var row in Enumerable.Range(0, Content.ProblemData.Dataset.Rows)) { 116 values[row, i + 1] = target[row].ToString(); 117 } 118 119 columnNames.AddRange(new string[] { targetVariable + "(actual)", targetVariable + "(training)", targetVariable + "(test)" }); 120 i += 3; 121 targetVariableIndex++; 122 } // foreach 123 115 124 116 125 matrix = new StringMatrix(values); 117 matrix.ColumnNames = new string[] { "Id", TARGETVARIABLE_SERIES_NAME, PROGNOSEDVALUES_SERIES_NAME, PROGNOSEDVALUES_TRAINING_SERIES_NAME, PROGNOSEDVALUES_TEST_SERIES_NAME, "Absolute Error (all)", "Relative Error (all)" };126 matrix.ColumnNames = columnNames.ToArray(); 118 127 matrix.SortableView = true; 119 } 128 129 } // if 120 130 matrixView.Content = matrix; 121 131 }
Note: See TracChangeset
for help on using the changeset viewer.