Class LabelMetric
java.lang.Object
org.tribuo.classification.evaluation.LabelMetric
- All Implemented Interfaces:
EvaluationMetric<Label,
LabelMetric.Context>
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
The context for aLabelMetric
is aConfusionMatrix
.Nested classes/interfaces inherited from interface org.tribuo.evaluation.metrics.EvaluationMetric
EvaluationMetric.Average
-
Constructor Summary
ConstructorDescriptionLabelMetric
(MetricTarget<Label> tgt, String name, ToDoubleBiFunction<MetricTarget<Label>, LabelMetric.Context> impl) Construct a newLabelMetric
for the supplied metric target, using the supplied function. -
Method Summary
Modifier and TypeMethodDescriptiondouble
compute
(LabelMetric.Context context) Compute the result of this metric from the input context.createContext
(Model<Label> model, List<Prediction<Label>> 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
-
LabelMetric
public LabelMetric(MetricTarget<Label> tgt, String name, ToDoubleBiFunction<MetricTarget<Label>, LabelMetric.Context> impl) Construct a newLabelMetric
for the supplied metric target, using the supplied function.- Parameters:
tgt
- The metric target.name
- The name of the metric.impl
- The implementing function.
-
-
Method Details
-
compute
Description copied from interface:EvaluationMetric
Compute the result of this metric from the input context.- Specified by:
compute
in interfaceEvaluationMetric<Label,
LabelMetric.Context> - Parameters:
context
- The context to use.- Returns:
- The value of the metric.
-
getTarget
Description copied from interface:EvaluationMetric
The target for this metric instance.- Specified by:
getTarget
in interfaceEvaluationMetric<Label,
LabelMetric.Context> - Returns:
- The metric target.
-
getName
Description copied from interface:EvaluationMetric
The name of this metric.- Specified by:
getName
in interfaceEvaluationMetric<Label,
LabelMetric.Context> - Returns:
- The name.
-
equals
-
hashCode
public int hashCode() -
toString
-
createContext
Description copied from interface:EvaluationMetric
Creates the context this metric uses to compute it's value.- Specified by:
createContext
in interfaceEvaluationMetric<Label,
LabelMetric.Context> - Parameters:
model
- The model to use.predictions
- The predictions to use.- Returns:
- The metric context.
-