Changeset 15280 for branches/Async/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionEstimatedValuesView.cs
- Timestamp:
- 07/23/17 00:52:14 (7 years ago)
- Location:
- branches/Async
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Async
- Property svn:mergeinfo changed
-
branches/Async/HeuristicLab.Problems.DataAnalysis.Views
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Views (added) merged: 13397,13439,13592,13705,13711,13715,13764,13766,13938,13942,13958,13992
- Property svn:mergeinfo changed
-
branches/Async/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionEstimatedValuesView.cs
r12012 r15280 25 25 using HeuristicLab.Data.Views; 26 26 using HeuristicLab.MainForm; 27 using HeuristicLab.MainForm.WindowsForms;28 27 29 28 namespace HeuristicLab.Problems.DataAnalysis.Views { … … 68 67 } 69 68 70 pr ivatevoid Content_ProblemDataChanged(object sender, EventArgs e) {69 protected virtual void Content_ProblemDataChanged(object sender, EventArgs e) { 71 70 OnContentChanged(); 72 71 } 73 72 74 pr ivatevoid Content_ModelChanged(object sender, EventArgs e) {73 protected virtual void Content_ModelChanged(object sender, EventArgs e) { 75 74 OnContentChanged(); 76 75 } … … 81 80 } 82 81 83 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() { 84 118 if (InvokeRequired) Invoke((Action)UpdateEstimatedValues); 85 119 else { 86 120 StringMatrix matrix = null; 87 121 if (Content != null) { 88 string[,] values = new string[Content.ProblemData.Dataset.Rows, 7]; 89 90 double[] target = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable).ToArray(); 91 var estimated = Content.EstimatedValues.GetEnumerator(); 92 var estimated_training = Content.EstimatedTrainingValues.GetEnumerator(); 93 var estimated_test = Content.EstimatedTestValues.GetEnumerator(); 94 95 foreach (var row in Content.ProblemData.TrainingIndices) { 96 estimated_training.MoveNext(); 97 values[row, 3] = estimated_training.Current.ToString(); 98 } 99 100 foreach (var row in Content.ProblemData.TestIndices) { 101 estimated_test.MoveNext(); 102 values[row, 4] = estimated_test.Current.ToString(); 103 } 104 105 foreach (var row in Enumerable.Range(0, Content.ProblemData.Dataset.Rows)) { 106 estimated.MoveNext(); 107 double est = estimated.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 / target[row]).ToString(); 114 } 115 116 matrix = new StringMatrix(values); 117 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)" }; 118 matrix.SortableView = true; 122 matrix = CreateValueMatrix(); 119 123 } 120 124 matrixView.Content = matrix;
Note: See TracChangeset
for help on using the changeset viewer.