- Timestamp:
- 05/23/11 16:13:43 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionEstimatedValuesView.cs
r6238 r6255 27 27 using HeuristicLab.MainForm; 28 28 using HeuristicLab.MainForm.WindowsForms; 29 using System.Globalization; 29 30 30 31 namespace HeuristicLab.Problems.DataAnalysis.Views { … … 33 34 public partial class RegressionSolutionEstimatedValuesView : ItemView, IRegressionSolutionEvaluationView { 34 35 private const string TARGETVARIABLE_SERIES_NAME = "Target Variable"; 36 private const string ESTIMATEDVALUES_SERIES_NAME = "Estimated Values (all)"; 35 37 private const string ESTIMATEDVALUES_TRAINING_SERIES_NAME = "Estimated Values (training)"; 36 38 private const string ESTIMATEDVALUES_TEST_SERIES_NAME = "Estimated Values (test)"; … … 84 86 if (InvokeRequired) Invoke((Action)UpdateEstimatedValues); 85 87 else { 86 DoubleMatrix matrix = null;88 StringMatrix matrix = null; 87 89 if (Content != null) { 88 double[,] values = new double[Content.ProblemData.Dataset.Rows, 5]; 89 // initialize to double.NaN 90 for (int row = 0; row < Content.ProblemData.Dataset.Rows; row++) 91 for (int column = 0; column < 5; column++) 92 values[row, column] = double.NaN; 90 string[,] values = new string[Content.ProblemData.Dataset.Rows, 7]; 93 91 94 92 double[] target = Content.ProblemData.Dataset.GetVariableValues(Content.ProblemData.TargetVariable); 93 var estimated = Content.EstimatedValues.GetEnumerator(); 95 94 var estimated_training = Content.EstimatedTrainingValues.GetEnumerator(); 96 95 var estimated_test = Content.EstimatedTestValues.GetEnumerator(); … … 98 97 foreach (var row in Content.ProblemData.TrainingIndizes) { 99 98 estimated_training.MoveNext(); 100 values[row, 1] = estimated_training.Current;99 values[row, 3] = estimated_training.Current.ToString(); 101 100 } 102 101 103 102 foreach (var row in Content.ProblemData.TestIndizes) { 104 103 estimated_test.MoveNext(); 105 values[row, 2] = estimated_test.Current;104 values[row, 4] = estimated_test.Current.ToString(); 106 105 } 107 106 108 for (int row = 0; row < target.Length; row++) { 109 values[row, 0] = target[row]; 110 double est = values[row, 1]; 111 if (!double.IsNaN(est)) { 112 values[row, 3] = Math.Abs(est - target[row]); 113 values[row, 4] = Math.Abs(values[row, 3] / target[row]); 114 } 107 foreach (var row in Enumerable.Range(0, Content.ProblemData.Dataset.Rows)) { 108 estimated.MoveNext(); 109 double est = estimated.Current; 110 double res = Math.Abs(est - target[row]); 111 values[row, 0] = row.ToString(); 112 values[row, 1] = target[row].ToString(); 113 values[row, 2] = est.ToString(); 114 values[row, 5] = Math.Abs(res).ToString(); 115 values[row, 6] = Math.Abs(res / est).ToString(); 115 116 } 116 117 117 matrix = new DoubleMatrix(values); 118 matrix.ColumnNames = new string[] { TARGETVARIABLE_SERIES_NAME, ESTIMATEDVALUES_TRAINING_SERIES_NAME, ESTIMATEDVALUES_TEST_SERIES_NAME, "Absolute Error (training)", "Relative Error (training)" }; 118 matrix = new StringMatrix(values); 119 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)" }; 120 matrix.SortableView = true; 119 121 } 120 122 matrixView.Content = matrix;
Note: See TracChangeset
for help on using the changeset viewer.