CVB.Net 15.0
Loading...
Searching...
No Matches
ConfusionMatrix Class Reference

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. More...

Classes

struct  PredictionResult
 The information contained in each cell of the confusion matrix. More...
 

Public Member Functions

 ConfusionMatrix (ClassificationTestResult res)
 Constructor.
 
int TotalSamples (int classIndex)
 Determine the total number of samples available for a given class.
 
int TotalSamples ()
 Return the total sample count.
 
int TotalCorrect (int classIndex)
 Number of correctly classified samples in a given class.
 
int TotalCorrect ()
 Overall number of correctly classified samples.
 
int TotalErrors (int classIndex)
 Determine the total number of errors made for a given class.
 
int TotalErrors ()
 Determine the total error count.
 
int TotalRejects ()
 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).
 
ReadOnlyCollection< PredictionResultRejects (int classIndex)
 Get the rejects for a given class.
 

Properties

int NumClasses [get]
 Number of classes in this matrix.
 
ReadOnlyCollection< PredictionResultthis[int trueClass, int predictedClass] [get]
 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.
 
double ConfidenceThreshold [get, set]
 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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ConfusionMatrix()

Constructor.

Parameters
resClassificationTestResult for which to calculate the confusion matrix.

Member Function Documentation

◆ Rejects()

ReadOnlyCollection< PredictionResult > Rejects ( int classIndex)

Get the rejects for a given class.

Parameters
classIndexIndex of the class for which to retrieve the rejected results.
Returns
Num of rejected results for the class referred to by the classIndex parameter.

◆ TotalCorrect() [1/2]

int TotalCorrect ( )

Overall number of correctly classified samples.

Returns
Total number of correct results.

◆ TotalCorrect() [2/2]

int TotalCorrect ( int classIndex)

Number of correctly classified samples in a given class.

Parameters
classIndexIndex of the class for which to query the number of correct classifications.
Returns
Total number of correct classifications for the class referred to by the classIndex parameter.

◆ TotalErrors() [1/2]

int TotalErrors ( )

Determine the total error count.

Returns
Total error count over all classes.

◆ TotalErrors() [2/2]

int TotalErrors ( int classIndex)

Determine the total number of errors made for a given class.

Parameters
classIndexIndex of the class for which to query the number of correct results.
Returns
The number of correct results for the class referred to by the classIndex parameter.

◆ TotalRejects()

int TotalRejects ( )

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).

Returns
Total number of rejects over all classes.

◆ TotalSamples() [1/2]

int TotalSamples ( )

Return the total sample count.

Returns
Total number of samples over all classes.

◆ TotalSamples() [2/2]

int TotalSamples ( int classIndex)

Determine the total number of samples available for a given class.

Parameters
classIndexIndex of the class for which to query the number of samples.
Returns
Total number of samples in the class referred to by the classIndex parameter.

Property Documentation

◆ this[int trueClass, int predictedClass]

ReadOnlyCollection<PredictionResult> this[int trueClass, int predictedClass]
get

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.

Parameters
predictedClass
trueClass
Returns