Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/01/11 17:48:53 (13 years ago)
Author:
mkommend
Message:

#1479: Integrated trunk changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionConfusionMatrixView.cs

    r6239 r6618  
    7878          dataGridView.ColumnCount = 1;
    7979        } 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;
    8282
    8383          int i = 0;
     
    8787            i++;
    8888          }
     89          dataGridView.Columns[i].HeaderText = "Actual not classified";
     90          dataGridView.Rows[i].HeaderCell.Value = "Predicted not classified";
     91
    8992          dataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.ColumnHeader);
    9093          dataGridView.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders);
     
    100103        if (Content == null) return;
    101104
    102         double[,] confusionMatrix = new double[Content.ProblemData.Classes, Content.ProblemData.Classes];
     105        double[,] confusionMatrix = new double[Content.ProblemData.Classes + 1, Content.ProblemData.Classes + 1];
    103106        IEnumerable<int> rows;
    104107
     
    109112        } else if (cmbSamples.SelectedItem.ToString() == TestSamples) {
    110113          rows = Content.ProblemData.TestIndizes;
    111           predictedValues = Content.EstimatedTestClassValues.ToArray();         
     114          predictedValues = Content.EstimatedTestClassValues.ToArray();
    112115        } else throw new InvalidOperationException();
    113116
     
    124127          double targetValue = targetValues[i];
    125128          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          }
    128137
    129138          confusionMatrix[predictedIndex, targetIndex] += 1;
Note: See TracChangeset for help on using the changeset viewer.