- Timestamp:
- 05/20/11 16:10:07 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionConfusionMatrixView.cs
r5975 r6239 103 103 IEnumerable<int> rows; 104 104 105 double[] predictedValues; 105 106 if (cmbSamples.SelectedItem.ToString() == TrainingSamples) { 106 107 rows = Content.ProblemData.TrainingIndizes; 108 predictedValues = Content.EstimatedTrainingClassValues.ToArray(); 107 109 } else if (cmbSamples.SelectedItem.ToString() == TestSamples) { 108 110 rows = Content.ProblemData.TestIndizes; 111 predictedValues = Content.EstimatedTestClassValues.ToArray(); 109 112 } else throw new InvalidOperationException(); 113 114 double[] targetValues = Content.ProblemData.Dataset.GetEnumeratedVariableValues(Content.ProblemData.TargetVariable, rows).ToArray(); 110 115 111 116 Dictionary<double, int> classValueIndexMapping = new Dictionary<double, int>(); … … 115 120 index++; 116 121 } 117 118 double[] targetValues = Content.ProblemData.Dataset.GetEnumeratedVariableValues(Content.ProblemData.TargetVariable, rows).ToArray();119 double[] predictedValues = Content.GetEstimatedClassValues(rows).ToArray();120 122 121 123 for (int i = 0; i < targetValues.Length; i++) { -
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.