Class MultiLabelConfusionMatrix
java.lang.Object
org.tribuo.multilabel.evaluation.MultiLabelConfusionMatrix
- All Implemented Interfaces:
ConfusionMatrix<MultiLabel>
A
ConfusionMatrix which accepts MultiLabels.
In a multi-label confusion matrix M,
tn = M[:, 0, 0] fn = M[:, 0, 1] fp = M[:, 1, 0] tp = M[:, 1, 1]
For class-wise values,
tn(class i) = M[i, 0, 0] fn(class i) = M[i, 0, 1] fp(class i) = M[i, 1, 0] tp(class i) = M[i, 1, 1]
-
Constructor Summary
ConstructorsConstructorDescriptionMultiLabelConfusionMatrix(Model<MultiLabel> model, List<Prediction<MultiLabel>> predictions) Constructs a multi-label confusion matrix for the specified model and predictions. -
Method Summary
Modifier and TypeMethodDescriptiondoubleconfusion(MultiLabel predicted, MultiLabel truth) The number of times the supplied predicted label was returned for the supplied true class.doublefn(MultiLabel cls) The number of false negatives for the supplied label.doublefp(MultiLabel cls) The number of false positives for the supplied label.Returns the classification domain that this confusion matrix operates over.Gets the current label order.observed()The values this confusion matrix has seen.voidsetLabelOrder(List<MultiLabel> labelOrder) Sets the label order used intoString().doublesupport()The number of examples this confusion matrix has seen.doublesupport(MultiLabel cls) The number of examples with this true label this confusion matrix has seen.doubletn(MultiLabel cls) The number of true negatives for the supplied label.toString()doubletp(MultiLabel cls) The number of true positives for the supplied label.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.tribuo.classification.evaluation.ConfusionMatrix
fn, fp, tn, tp
-
Constructor Details
-
MultiLabelConfusionMatrix
Constructs a multi-label confusion matrix for the specified model and predictions.- Parameters:
model- The model.predictions- The predictions.
-
-
Method Details
-
support
Description copied from interface:ConfusionMatrixThe number of examples with this true label this confusion matrix has seen.- Specified by:
supportin interfaceConfusionMatrix<MultiLabel>- Parameters:
cls- The label.- Returns:
- The number of examples.
-
getDomain
Description copied from interface:ConfusionMatrixReturns the classification domain that this confusion matrix operates over.- Specified by:
getDomainin interfaceConfusionMatrix<MultiLabel>- Returns:
- The classification domain.
-
observed
Description copied from interface:ConfusionMatrixThe values this confusion matrix has seen.The default implementation is provided for compatibility reasons and will be removed in a future major release. It defaults to returning the output domain.
- Specified by:
observedin interfaceConfusionMatrix<MultiLabel>- Returns:
- The set of observed outputs.
-
support
public double support()Description copied from interface:ConfusionMatrixThe number of examples this confusion matrix has seen.- Specified by:
supportin interfaceConfusionMatrix<MultiLabel>- Returns:
- The number of examples.
-
tp
Description copied from interface:ConfusionMatrixThe number of true positives for the supplied label.- Specified by:
tpin interfaceConfusionMatrix<MultiLabel>- Parameters:
cls- The label.- Returns:
- The number of examples.
-
fp
Description copied from interface:ConfusionMatrixThe number of false positives for the supplied label.- Specified by:
fpin interfaceConfusionMatrix<MultiLabel>- Parameters:
cls- The label.- Returns:
- The number of examples.
-
fn
Description copied from interface:ConfusionMatrixThe number of false negatives for the supplied label.- Specified by:
fnin interfaceConfusionMatrix<MultiLabel>- Parameters:
cls- The label.- Returns:
- The number of examples.
-
tn
Description copied from interface:ConfusionMatrixThe number of true negatives for the supplied label.- Specified by:
tnin interfaceConfusionMatrix<MultiLabel>- Parameters:
cls- The label.- Returns:
- The number of examples.
-
confusion
Description copied from interface:ConfusionMatrixThe number of times the supplied predicted label was returned for the supplied true class.- Specified by:
confusionin interfaceConfusionMatrix<MultiLabel>- Parameters:
predicted- The predicted label.truth- The true label.- Returns:
- The number of examples predicted as
predictedLabelwhen the true label wastrueLabel.
-
setLabelOrder
Sets the label order used intoString().If the label order is a subset of the labels in the domain, only the labels present in the label order will be displayed.
- Specified by:
setLabelOrderin interfaceConfusionMatrix<MultiLabel>- Parameters:
labelOrder- The label order to use.
-
getLabelOrder
Gets the current label order.If the label order is a subset of the labels in the domain, only the labels present in the label order will be displayed.
- Specified by:
getLabelOrderin interfaceConfusionMatrix<MultiLabel>- Returns:
- The label order.
-
toString
-