Interface ConfusionMatrix<T extends Classifiable<T>>
- Type Parameters:
T- The type of the output.
- All Known Implementing Classes:
LabelConfusionMatrix,MultiLabelConfusionMatrix
public interface ConfusionMatrix<T extends Classifiable<T>>
A confusion matrix for
Classifiables.
We interpret it as follows:
C[i, j] = k
means "the TRUE class 'j' was PREDICTED to be class 'i' a total of 'k' times".
In other words, the row indices correspond to the model's predictions, and the column indices correspond to the ground truth.
-
Method Summary
Modifier and TypeMethodDescriptiondoubleThe number of times the supplied predicted label was returned for the supplied true class.default doublefn()The total number of false negatives.doubleThe number of false negatives for the supplied label.default doublefp()The total number of false positives.doubleThe number of false positives for the supplied label.Returns the classification domain that this confusion matrix operates over.static <T extends Classifiable<T>>
doublesumOverOutputs(ImmutableOutputInfo<T> domain, ToDoubleFunction<T> getter) Sums the supplied getter over the domain.doublesupport()The number of examples this confusion matrix has seen.doubleThe number of examples with this true label this confusion matrix has seen.default doubletn()The total number of true negatives.doubleThe number of true negatives for the supplied label.default doubletp()The total number of true positives.doubleThe number of true positives for the supplied label.
-
Method Details
-
getDomain
Returns the classification domain that this confusion matrix operates over.- Returns:
- The classification domain.
-
support
double support()The number of examples this confusion matrix has seen.- Returns:
- The number of examples.
-
support
-
tp
-
fp
-
fn
-
tn
-
confusion
The number of times the supplied predicted label was returned for the supplied true class.- Parameters:
predictedLabel- The predicted label.trueLabel- The true label.- Returns:
- The number of examples predicted as
predictedLabelwhen the true label wastrueLabel.
-
tp
-
fp
-
fn
-
tn
-
sumOverOutputs
static <T extends Classifiable<T>> double sumOverOutputs(ImmutableOutputInfo<T> domain, ToDoubleFunction<T> getter) Sums the supplied getter over the domain.- Type Parameters:
T- The type of the output.- Parameters:
domain- The domain to sum over.getter- The getter to use.- Returns:
- The total summed over the domain.
-