Package org.tribuo.clustering.evaluation
Class ClusteringMetric
java.lang.Object
org.tribuo.clustering.evaluation.ClusteringMetric
- All Implemented Interfaces:
EvaluationMetric<ClusterID,
org.tribuo.clustering.evaluation.ClusteringMetric.Context>
public class ClusteringMetric
extends Object
implements EvaluationMetric<ClusterID,org.tribuo.clustering.evaluation.ClusteringMetric.Context>
A metric for evaluating clustering problems. The sufficient statistics are the cluster
ids assigned to every point, along with the "true" ids.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.tribuo.evaluation.metrics.EvaluationMetric
EvaluationMetric.Average
-
Constructor Summary
ConstructorDescriptionClusteringMetric
(MetricTarget<ClusterID> target, String name, BiFunction<MetricTarget<ClusterID>, org.tribuo.clustering.evaluation.ClusteringMetric.Context, Double> impl) Constructs a clustering metric using the supplied parameters. -
Method Summary
Modifier and TypeMethodDescriptiondouble
compute
(org.tribuo.clustering.evaluation.ClusteringMetric.Context context) Compute the result of this metric from the input context.org.tribuo.clustering.evaluation.ClusteringMetric.Context
createContext
(Model<ClusterID> model, List<Prediction<ClusterID>> predictions) Creates the context this metric uses to compute it's value.getName()
The name of this metric.The target for this metric instance.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.tribuo.evaluation.metrics.EvaluationMetric
createContext, getID
-
Constructor Details
-
ClusteringMetric
public ClusteringMetric(MetricTarget<ClusterID> target, String name, BiFunction<MetricTarget<ClusterID>, org.tribuo.clustering.evaluation.ClusteringMetric.Context, Double> impl) Constructs a clustering metric using the supplied parameters.- Parameters:
target
- The metric target.name
- The metric name.impl
- The implementation function.
-
-
Method Details
-
compute
public double compute(org.tribuo.clustering.evaluation.ClusteringMetric.Context context) Description copied from interface:EvaluationMetric
Compute the result of this metric from the input context.- Specified by:
compute
in interfaceEvaluationMetric<ClusterID,
org.tribuo.clustering.evaluation.ClusteringMetric.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<ClusterID,
org.tribuo.clustering.evaluation.ClusteringMetric.Context> - Returns:
- The metric target.
-
getName
Description copied from interface:EvaluationMetric
The name of this metric.- Specified by:
getName
in interfaceEvaluationMetric<ClusterID,
org.tribuo.clustering.evaluation.ClusteringMetric.Context> - Returns:
- The name.
-
createContext
public org.tribuo.clustering.evaluation.ClusteringMetric.Context createContext(Model<ClusterID> model, List<Prediction<ClusterID>> predictions) Description copied from interface:EvaluationMetric
Creates the context this metric uses to compute it's value.- Specified by:
createContext
in interfaceEvaluationMetric<ClusterID,
org.tribuo.clustering.evaluation.ClusteringMetric.Context> - Parameters:
model
- The model to use.predictions
- The predictions to use.- Returns:
- The metric context.
-
toString
-