- Timestamp:
- 02/07/16 17:43:22 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionEstimatedValuesView.cs
r13439 r13592 42 42 } 43 43 44 pr otectedStringConvertibleMatrixView matrixView;44 private StringConvertibleMatrixView matrixView; 45 45 46 46 public RegressionSolutionEstimatedValuesView() … … 67 67 } 68 68 69 pr ivatevoid Content_ProblemDataChanged(object sender, EventArgs e) {69 protected virtual void Content_ProblemDataChanged(object sender, EventArgs e) { 70 70 OnContentChanged(); 71 71 } 72 72 73 pr ivatevoid Content_ModelChanged(object sender, EventArgs e) {73 protected virtual void Content_ModelChanged(object sender, EventArgs e) { 74 74 OnContentChanged(); 75 75 } … … 80 80 } 81 81 82 private void UpdateEstimatedValues() { 82 protected virtual StringMatrix CreateValueMatrix() { 83 string[,] values = new string[Content.ProblemData.Dataset.Rows, 7]; 84 85 double[] target = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable).ToArray(); 86 var estimated = Content.EstimatedValues.GetEnumerator(); 87 var estimated_training = Content.EstimatedTrainingValues.GetEnumerator(); 88 var estimated_test = Content.EstimatedTestValues.GetEnumerator(); 89 90 foreach (var row in Content.ProblemData.TrainingIndices) { 91 estimated_training.MoveNext(); 92 values[row, 3] = estimated_training.Current.ToString(); 93 } 94 95 foreach (var row in Content.ProblemData.TestIndices) { 96 estimated_test.MoveNext(); 97 values[row, 4] = estimated_test.Current.ToString(); 98 } 99 100 foreach (var row in Enumerable.Range(0, Content.ProblemData.Dataset.Rows)) { 101 estimated.MoveNext(); 102 double est = estimated.Current; 103 double res = Math.Abs(est - target[row]); 104 values[row, 0] = row.ToString(); 105 values[row, 1] = target[row].ToString(); 106 values[row, 2] = est.ToString(); 107 values[row, 5] = Math.Abs(res).ToString(); 108 values[row, 6] = Math.Abs(res / target[row]).ToString(); 109 } 110 111 var matrix = new StringMatrix(values); 112 matrix.ColumnNames = new string[] { "Id", TARGETVARIABLE_SERIES_NAME, ESTIMATEDVALUES_SERIES_NAME, ESTIMATEDVALUES_TRAINING_SERIES_NAME, ESTIMATEDVALUES_TEST_SERIES_NAME, "Absolute Error (all)", "Relative Error (all)" }; 113 matrix.SortableView = true; 114 return matrix; 115 } 116 117 protected virtual void UpdateEstimatedValues() { 83 118 if (InvokeRequired) Invoke((Action)UpdateEstimatedValues); 84 119 else { 85 120 StringMatrix matrix = null; 86 121 if (Content != null) { 87 string[,] values = new string[Content.ProblemData.Dataset.Rows, 7]; 88 89 double[] target = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable).ToArray(); 90 var estimated = Content.EstimatedValues.GetEnumerator(); 91 var estimated_training = Content.EstimatedTrainingValues.GetEnumerator(); 92 var estimated_test = Content.EstimatedTestValues.GetEnumerator(); 93 94 foreach (var row in Content.ProblemData.TrainingIndices) { 95 estimated_training.MoveNext(); 96 values[row, 3] = estimated_training.Current.ToString(); 97 } 98 99 foreach (var row in Content.ProblemData.TestIndices) { 100 estimated_test.MoveNext(); 101 values[row, 4] = estimated_test.Current.ToString(); 102 } 103 104 foreach (var row in Enumerable.Range(0, Content.ProblemData.Dataset.Rows)) { 105 estimated.MoveNext(); 106 double est = estimated.Current; 107 double res = Math.Abs(est - target[row]); 108 values[row, 0] = row.ToString(); 109 values[row, 1] = target[row].ToString(); 110 values[row, 2] = est.ToString(); 111 values[row, 5] = Math.Abs(res).ToString(); 112 values[row, 6] = Math.Abs(res / target[row]).ToString(); 113 } 114 115 matrix = new StringMatrix(values); 116 matrix.ColumnNames = new string[] { "Id", TARGETVARIABLE_SERIES_NAME, ESTIMATEDVALUES_SERIES_NAME, ESTIMATEDVALUES_TRAINING_SERIES_NAME, ESTIMATEDVALUES_TEST_SERIES_NAME, "Absolute Error (all)", "Relative Error (all)" }; 117 matrix.SortableView = true; 122 matrix = CreateValueMatrix(); 118 123 } 119 124 matrixView.Content = matrix;
Note: See TracChangeset
for help on using the changeset viewer.