Changeset 6618 for branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionConfusionMatrixView.cs
- Timestamp:
- 08/01/11 17:48:53 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionConfusionMatrixView.cs
r6239 r6618 78 78 dataGridView.ColumnCount = 1; 79 79 } else { 80 dataGridView.ColumnCount = Content.ProblemData.Classes ;81 dataGridView.RowCount = Content.ProblemData.Classes ;80 dataGridView.ColumnCount = Content.ProblemData.Classes + 1; 81 dataGridView.RowCount = Content.ProblemData.Classes + 1; 82 82 83 83 int i = 0; … … 87 87 i++; 88 88 } 89 dataGridView.Columns[i].HeaderText = "Actual not classified"; 90 dataGridView.Rows[i].HeaderCell.Value = "Predicted not classified"; 91 89 92 dataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.ColumnHeader); 90 93 dataGridView.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders); … … 100 103 if (Content == null) return; 101 104 102 double[,] confusionMatrix = new double[Content.ProblemData.Classes , Content.ProblemData.Classes];105 double[,] confusionMatrix = new double[Content.ProblemData.Classes + 1, Content.ProblemData.Classes + 1]; 103 106 IEnumerable<int> rows; 104 107 … … 109 112 } else if (cmbSamples.SelectedItem.ToString() == TestSamples) { 110 113 rows = Content.ProblemData.TestIndizes; 111 predictedValues = Content.EstimatedTestClassValues.ToArray(); 114 predictedValues = Content.EstimatedTestClassValues.ToArray(); 112 115 } else throw new InvalidOperationException(); 113 116 … … 124 127 double targetValue = targetValues[i]; 125 128 double predictedValue = predictedValues[i]; 126 int targetIndex = classValueIndexMapping[targetValue]; 127 int predictedIndex = classValueIndexMapping[predictedValue]; 129 int targetIndex; 130 int predictedIndex; 131 if (!classValueIndexMapping.TryGetValue(targetValue, out targetIndex)) { 132 targetIndex = Content.ProblemData.Classes; 133 } 134 if (!classValueIndexMapping.TryGetValue(predictedValue, out predictedIndex)) { 135 predictedIndex = Content.ProblemData.Classes; 136 } 128 137 129 138 confusionMatrix[predictedIndex, targetIndex] += 1;
Note: See TracChangeset
for help on using the changeset viewer.