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.
  • 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

      public MetricTarget<MultiLabel> getTarget()
      Description copied from interface: EvaluationMetric
      The target for this metric instance.
      Specified by:
      getTarget in interface EvaluationMetric<MultiLabel,org.tribuo.multilabel.evaluation.MultiLabelMetric.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<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 interface EvaluationMetric<MultiLabel,org.tribuo.multilabel.evaluation.MultiLabelMetric.Context>
      Parameters:
      context - The context to use.
      Returns:
      The value of the metric.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • 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 interface EvaluationMetric<MultiLabel,org.tribuo.multilabel.evaluation.MultiLabelMetric.Context>
      Parameters:
      model - The model to use.
      predictions - The predictions to use.
      Returns:
      The metric context.