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.
  • 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 interface EvaluationMetric<ClusterID,org.tribuo.clustering.evaluation.ClusteringMetric.Context>
      Parameters:
      context - The context to use.
      Returns:
      The value of the metric.
    • getTarget

      public MetricTarget<ClusterID> getTarget()
      Description copied from interface: EvaluationMetric
      The target for this metric instance.
      Specified by:
      getTarget in interface EvaluationMetric<ClusterID,org.tribuo.clustering.evaluation.ClusteringMetric.Context>
      Returns:
      The metric target.
    • getName

      public String getName()
      Description copied from interface: EvaluationMetric
      The name of this metric.
      Specified by:
      getName in interface EvaluationMetric<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 interface EvaluationMetric<ClusterID,org.tribuo.clustering.evaluation.ClusteringMetric.Context>
      Parameters:
      model - The model to use.
      predictions - The predictions to use.
      Returns:
      The metric context.
    • toString

      public String toString()
      Overrides:
      toString in class Object