Package org.tribuo.multilabel.evaluation
Class MultiLabelMetric
java.lang.Object
org.tribuo.multilabel.evaluation.MultiLabelMetric
- All Implemented Interfaces:
EvaluationMetric<MultiLabel,
org.tribuo.multilabel.evaluation.MultiLabelMetric.Context>
public class MultiLabelMetric
extends Object
implements EvaluationMetric<MultiLabel,org.tribuo.multilabel.evaluation.MultiLabelMetric.Context>
A
EvaluationMetric
for evaluating MultiLabel
problems.
The sufficient statistics used must be held in a ConfusionMatrix
.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.tribuo.evaluation.metrics.EvaluationMetric
EvaluationMetric.Average
-
Constructor Summary
ConstructorDescriptionMultiLabelMetric
(MetricTarget<MultiLabel> target, String name, BiFunction<MetricTarget<MultiLabel>, org.tribuo.multilabel.evaluation.MultiLabelMetric.Context, Double> impl) Constructs a multi-label metric. -
Method Summary
Modifier and TypeMethodDescriptiondouble
compute
(org.tribuo.multilabel.evaluation.MultiLabelMetric.Context context) Compute the result of this metric from the input context.org.tribuo.multilabel.evaluation.MultiLabelMetric.Context
createContext
(Model<MultiLabel> model, List<Prediction<MultiLabel>> predictions) Creates the context this metric uses to compute it's value.boolean
getName()
The name of this metric.The target for this metric instance.int
hashCode()
toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.tribuo.evaluation.metrics.EvaluationMetric
createContext, getID
-
Constructor Details
-
MultiLabelMetric
public MultiLabelMetric(MetricTarget<MultiLabel> target, String name, BiFunction<MetricTarget<MultiLabel>, org.tribuo.multilabel.evaluation.MultiLabelMetric.Context, Double> impl) Constructs a multi-label metric.- Parameters:
target
- The metric target.name
- The name of the metric.impl
- The implementing function for this metric.
-
-
Method Details
-
getTarget
Description copied from interface:EvaluationMetric
The target for this metric instance.- Specified by:
getTarget
in interfaceEvaluationMetric<MultiLabel,
org.tribuo.multilabel.evaluation.MultiLabelMetric.Context> - Returns:
- The metric target.
-
getName
Description copied from interface:EvaluationMetric
The name of this metric.- Specified by:
getName
in interfaceEvaluationMetric<MultiLabel,
org.tribuo.multilabel.evaluation.MultiLabelMetric.Context> - Returns:
- The name.
-
compute
public double compute(org.tribuo.multilabel.evaluation.MultiLabelMetric.Context context) Description copied from interface:EvaluationMetric
Compute the result of this metric from the input context.- Specified by:
compute
in interfaceEvaluationMetric<MultiLabel,
org.tribuo.multilabel.evaluation.MultiLabelMetric.Context> - Parameters:
context
- The context to use.- Returns:
- The value of the metric.
-
toString
-
equals
-
hashCode
public int hashCode() -
createContext
public org.tribuo.multilabel.evaluation.MultiLabelMetric.Context createContext(Model<MultiLabel> model, List<Prediction<MultiLabel>> predictions) Description copied from interface:EvaluationMetric
Creates the context this metric uses to compute it's value.- Specified by:
createContext
in interfaceEvaluationMetric<MultiLabel,
org.tribuo.multilabel.evaluation.MultiLabelMetric.Context> - Parameters:
model
- The model to use.predictions
- The predictions to use.- Returns:
- The metric context.
-