Package org.tribuo.multilabel.evaluation
Class MultiLabelConfusionMatrix
java.lang.Object
org.tribuo.multilabel.evaluation.MultiLabelConfusionMatrix
- All Implemented Interfaces:
ConfusionMatrix<MultiLabel>
A
ConfusionMatrix
which accepts MultiLabel
s.
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
ConstructorDescriptionMultiLabelConfusionMatrix
(Model<MultiLabel> model, List<Prediction<MultiLabel>> predictions) Constructs a multi-label confusion matrix for the specified model and predictions. -
Method Summary
Modifier and TypeMethodDescriptiondouble
confusion
(MultiLabel predicted, MultiLabel truth) The number of times the supplied predicted label was returned for the supplied true class.double
fn
(MultiLabel cls) The number of false negatives for the supplied label.double
fp
(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.void
setLabelOrder
(List<MultiLabel> labelOrder) Sets the label order used intoString()
.double
support()
The number of examples this confusion matrix has seen.double
support
(MultiLabel cls) The number of examples with this true label this confusion matrix has seen.double
tn
(MultiLabel cls) The number of true negatives for the supplied label.toString()
double
tp
(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, wait
Methods 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:ConfusionMatrix
The number of examples with this true label this confusion matrix has seen.- Specified by:
support
in interfaceConfusionMatrix<MultiLabel>
- Parameters:
cls
- The label.- Returns:
- The number of examples.
-
getDomain
Description copied from interface:ConfusionMatrix
Returns the classification domain that this confusion matrix operates over.- Specified by:
getDomain
in interfaceConfusionMatrix<MultiLabel>
- Returns:
- The classification domain.
-
observed
Description copied from interface:ConfusionMatrix
The 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:
observed
in interfaceConfusionMatrix<MultiLabel>
- Returns:
- The set of observed outputs.
-
support
public double support()Description copied from interface:ConfusionMatrix
The number of examples this confusion matrix has seen.- Specified by:
support
in interfaceConfusionMatrix<MultiLabel>
- Returns:
- The number of examples.
-
tp
Description copied from interface:ConfusionMatrix
The number of true positives for the supplied label.- Specified by:
tp
in interfaceConfusionMatrix<MultiLabel>
- Parameters:
cls
- The label.- Returns:
- The number of examples.
-
fp
Description copied from interface:ConfusionMatrix
The number of false positives for the supplied label.- Specified by:
fp
in interfaceConfusionMatrix<MultiLabel>
- Parameters:
cls
- The label.- Returns:
- The number of examples.
-
fn
Description copied from interface:ConfusionMatrix
The number of false negatives for the supplied label.- Specified by:
fn
in interfaceConfusionMatrix<MultiLabel>
- Parameters:
cls
- The label.- Returns:
- The number of examples.
-
tn
Description copied from interface:ConfusionMatrix
The number of true negatives for the supplied label.- Specified by:
tn
in interfaceConfusionMatrix<MultiLabel>
- Parameters:
cls
- The label.- Returns:
- The number of examples.
-
confusion
Description copied from interface:ConfusionMatrix
The number of times the supplied predicted label was returned for the supplied true class.- Specified by:
confusion
in interfaceConfusionMatrix<MultiLabel>
- Parameters:
predicted
- The predicted label.truth
- The true label.- Returns:
- The number of examples predicted as
predictedLabel
when 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:
setLabelOrder
in 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:
getLabelOrder
in interfaceConfusionMatrix<MultiLabel>
- Returns:
- The label order.
-
toString
-