Representation of a confusion matrix. More...
#include <cvb/polimago/confusion_matrix.hpp>
Public Member Functions | |
ConfusionMatrix (const ClassificationTestResult &res) | |
Constructor. More... | |
int | TotalSamples (int classIndex) const |
Determine the total number of samples available for a given class. More... | |
int | TotalSamples () const |
Return the total sample count. More... | |
int | TotalCorrect (int classIndex) const |
Number of correctly classified samples in a given class. More... | |
int | TotalCorrect () const |
Overall number of correctly classified samples. More... | |
int | TotalErrors (int classIndex) const |
Determine the total number of errors made for a given class. More... | |
int | TotalErrors () const |
Determine the total error count. More... | |
int | TotalRejects () const |
Total number of rejected items (i.e. items that have a confidence of less than the currently set threshold, no matter if they are correctly classified or not). More... | |
std::vector< PredictionResult > | Rejects (int classIndex) const |
Get the rejects for a given class. More... | |
int | NumClasses () const noexcept |
Number of classes in this matrix. More... | |
std::vector< PredictionResult > | At (int trueClass, int predictedClass) const |
Access the results stored in the confusion matrix. More... | |
double | ConfidenceThreshold () const noexcept |
Get threshold to be taken into account when determining the confusion matrix. More... | |
void | SetConfidenceThreshold (double threshold) |
Set the threshold to be taken into account when determining the confusion matrix. More... | |
Representation of a confusion matrix.
A confusion matrix is a matrix that gives detailed information about the kind of mistakes that occurred during a leave-out or sample test.
|
inline |
Constructor.
[in] | res | ClassificationTestResult for which to calculate the confusion matrix. |
Any | exception derived from std::exception including CvbException. |
|
inline |
Access the results stored in the confusion matrix.
[in] | trueClass | True class index. |
[in] | predictedClass | Prediction result. |
Any | exception derived from std::exception including CvbException. |
The confusion matrix is to be read as follows: The first index (usually considered the line index) corresponds to the true class index, whereas the 2nd index (column index) is the prediction result. Example: Consider the result counts in a confusion matrix for a two-class problem to be distributed as follows: A B A 10 3 B 1 6 This means that 10 samples of class A have been correctly identified as class A, while 3 samples of class A have been misclassified as class B. Likewise, one sample of class B has been misclassified as class A, while 6 samples of class B have been identified correctly.
|
inlinenoexcept |
Get threshold to be taken into account when determining the confusion matrix.
Does | not throw any exception. |
|
inlinenoexcept |
Number of classes in this matrix.
Does | not throw any exception. |
|
inline |
Get the rejects for a given class.
[in] | classIndex | Index of the class for which to retrieve the rejected results. |
Any | exception derived from std::exception including CvbException. |
|
inline |
Set the threshold to be taken into account when determining the confusion matrix.
[in] | threshold | The confidence threshold. |
Any | exception derived from std::exception including CvbException. |
If the threshold is modified, the whole matrix will be updated accordingly, so setting this property may be a costly action.
|
inline |
Overall number of correctly classified samples.
Any | exception derived from std::exception including CvbException. |
|
inline |
Number of correctly classified samples in a given class.
[in] | classIndex | Index of the class for which to query the number of correct classifications. |
Any | exception derived from std::exception including CvbException. |
|
inline |
Determine the total error count.
Any | exception derived from std::exception including CvbException. |
|
inline |
Determine the total number of errors made for a given class.
[in] | classIndex | Index of the class for which to query the number of incorrect results. |
Any | exception derived from std::exception including CvbException. |
|
inline |
Total number of rejected items (i.e. items that have a confidence of less than the currently set threshold, no matter if they are correctly classified or not).
Any | exception derived from std::exception including CvbException. |
|
inline |
Return the total sample count.
Any | exception derived from std::exception including CvbException. |
|
inline |
Determine the total number of samples available for a given class.
[in] | classIndex | Index of the class for which to query the number of samples. |
Any | exception derived from std::exception including CvbException. |