Representation of a confusion matrix. More...
Inherits object.
Public Member Functions | |
List[cvb.polimago.PredictionResult] | at (self, int true_class, int predicted_class) |
Access the results stored in the confusion matrix. More... | |
int | rejects (self, int class_index) |
Get the rejects for a given class. More... | |
int | total_correct (self, Optional[int] class_index) |
Determine the number of correctly classified samples (for a given class if class index is specified). More... | |
int | total_errors (self, Optional[int] class_index) |
Determine the number of errors (for a given class if class index is specified). More... | |
int | total_rejects (self) |
Total number of rejected items. More... | |
int | total_samples (self, Optional[int] class_index) |
Determine the total number of samples available (for a given class if class index is specified). More... | |
Properties | |
confidence_threshold = property | |
float: Threshold to be taken into account when determining the confusion matrix. More... | |
num_classes = property | |
int: Number of classes in this matrix. | |
Representation of a confusion matrix.
Create 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.
res : cvb.polimago.ClassificationTestResult ClassificationTestResult for which to calculate the confusion matrix.
List[cvb.polimago.PredictionResult] at | ( | self, | |
int | true_class, | ||
int | predicted_class | ||
) |
Access the results stored in the confusion matrix.
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.
true_class : int True class index.
predicted_class : int Prediction result.
List[cvb.polimago.PredictionResult] Confusion matrix value.
int rejects | ( | self, | |
int | class_index | ||
) |
Get the rejects for a given class.
class_index : int Index of the class for which to retrieve the rejected results.
int The rejected results for given class.
int total_correct | ( | self, | |
Optional[int] | class_index | ||
) |
Determine the number of correctly classified samples (for a given class if class index is specified).
class_index : Optional[int] Index of the class for which to query the number of correct classifications.
int Number of correctly classified samples - for the class referred to by the class_index parameter, over all classes if index not specified.
int total_errors | ( | self, | |
Optional[int] | class_index | ||
) |
Determine the number of errors (for a given class if class index is specified).
class_index : Optional[int] Index of the class for which to query the number of incorrect results.
int Number of incorrect results - for the class referred to by the class_index parameter, over all classes if index not specified.
int total_rejects | ( | self | ) |
Total number of rejected items.
Items that have a confidence of less than the currently set threshold, no matter if they are correctly classified or not).
int Total number of rejects over all classes.
int total_samples | ( | self, | |
Optional[int] | class_index | ||
) |
Determine the total number of samples available (for a given class if class index is specified).
class_index : Optional[int] Index of the class for which to query the number of samples.
int Total number of samples - in the class referred to by the class_index parameter, over all classes if index not specified.
|
static |
float: Threshold to be taken into account when determining the confusion matrix.
If the threshold is modified, the whole matrix will be updated accordingly, so setting this property may be a costly action.