Changeset 6239 for trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionEstimatedClassValuesView.cs
- Timestamp:
- 05/20/11 16:10:07 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionEstimatedClassValuesView.cs
r5975 r6239 32 32 [Content(typeof(IClassificationSolution))] 33 33 public partial class ClassificationSolutionEstimatedClassValuesView : ItemView, IClassificationSolutionEvaluationView { 34 private const string TARGETVARIABLE_SERIES_NAME = "TargetVariable"; 35 private const string ESTIMATEDVALUES_SERIES_NAME = "EstimatedClassValues"; 34 private const string TARGETVARIABLE_SERIES_NAME = "Target Variable"; 35 private const string ESTIMATEDVALUES_TRAINING_SERIES_NAME = "Estimated Class Values (training)"; 36 private const string ESTIMATEDVALUES_TEST_SERIES_NAME = "Estimated Class Values (test)"; 36 37 37 38 public new IClassificationSolution Content { … … 85 86 DoubleMatrix matrix = null; 86 87 if (Content != null) { 87 double[,] values = new double[Content.ProblemData.Dataset.Rows, 2]; 88 double[,] values = new double[Content.ProblemData.Dataset.Rows, 3]; 89 // fill with NaN 90 for (int row = 0; row < Content.ProblemData.Dataset.Rows; row++) 91 for (int column = 0; column < 3; column++) 92 values[row, column] = double.NaN; 88 93 89 94 double[] target = Content.ProblemData.Dataset.GetVariableValues(Content.ProblemData.TargetVariable); 90 double[] estimated = Content.EstimatedClassValues.ToArray();91 95 for (int row = 0; row < target.Length; row++) { 92 96 values[row, 0] = target[row]; 93 values[row, 1] = estimated[row]; 97 } 98 var estimatedTraining = Content.EstimatedTrainingClassValues.GetEnumerator(); 99 estimatedTraining.MoveNext(); 100 foreach (var trainingRow in Content.ProblemData.TrainingIndizes) { 101 values[trainingRow, 1] = estimatedTraining.Current; 102 estimatedTraining.MoveNext(); 103 } 104 var estimatedTest = Content.EstimatedTestClassValues.GetEnumerator(); 105 estimatedTest.MoveNext(); 106 foreach (var testRow in Content.ProblemData.TestIndizes) { 107 values[testRow, 2] = estimatedTest.Current; 108 estimatedTest.MoveNext(); 94 109 } 95 110 96 111 matrix = new DoubleMatrix(values); 97 matrix.ColumnNames = new string[] { TARGETVARIABLE_SERIES_NAME, ESTIMATEDVALUES_ SERIES_NAME };112 matrix.ColumnNames = new string[] { TARGETVARIABLE_SERIES_NAME, ESTIMATEDVALUES_TRAINING_SERIES_NAME, ESTIMATEDVALUES_TEST_SERIES_NAME }; 98 113 } 99 114 matrixView.Content = matrix;
Note: See TracChangeset
for help on using the changeset viewer.