Package org.tribuo.evaluation.metrics
Interface EvaluationMetric<T extends Output<T>,C extends MetricContext<T>>
- Type Parameters:
T
- The output type.C
- The context (information necessary to calculate this metric).
- All Known Implementing Classes:
AnomalyMetric
,ClusteringMetric
,LabelMetric
,MultiLabelMetric
,RegressionMetric
public interface EvaluationMetric<T extends Output<T>,C extends MetricContext<T>>
A metric that can be calculated for the specified output type.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
Specifies what form of average to use for aEvaluationMetric
. -
Method Summary
Modifier and TypeMethodDescriptiondouble
Compute the result of this metric from the input context.createContext
(Model<T> model, List<Prediction<T>> predictions) Creates the context this metric uses to compute it's value.default C
createContext
(Model<T> model, Dataset<T> dataset) Creates the metric context used to compute this metric's value, generatingPrediction
s for eachExample
in the supplied dataset.getID()
The metric ID, a combination of the metric target and metric name.getName()
The name of this metric.The target for this metric instance.
-
Method Details
-
compute
Compute the result of this metric from the input context.- Parameters:
context
- The context to use.- Returns:
- The value of the metric.
-
getTarget
MetricTarget<T> getTarget()The target for this metric instance.- Returns:
- The metric target.
-
getName
String getName()The name of this metric.- Returns:
- The name.
-
getID
The metric ID, a combination of the metric target and metric name.- Returns:
- The metric ID.
-
createContext
Creates the context this metric uses to compute it's value.- Parameters:
model
- The model to use.predictions
- The predictions to use.- Returns:
- The metric context.
-
createContext
Creates the metric context used to compute this metric's value, generatingPrediction
s for eachExample
in the supplied dataset.- Parameters:
model
- The model to use.dataset
- The dataset to predict outputs for.- Returns:
- The metric context.
-