Class AnomalyMetric

java.lang.Object
org.tribuo.anomaly.evaluation.AnomalyMetric
All Implemented Interfaces:
EvaluationMetric<Event,org.tribuo.anomaly.evaluation.AnomalyMetric.Context>

public class AnomalyMetric extends Object implements EvaluationMetric<Event,org.tribuo.anomaly.evaluation.AnomalyMetric.Context>
A metric for evaluating anomaly detection problems. The sufficient statistics must be encoded in the number of true positives, false positives, true negatives and false negatives.
  • Constructor Details

    • AnomalyMetric

      public AnomalyMetric(MetricTarget<Event> target, String name, ToDoubleBiFunction<MetricTarget<Event>,org.tribuo.anomaly.evaluation.AnomalyMetric.Context> impl)
      Creates an anomaly detection metric, with a specific name, using the supplied evaluation function.
      Parameters:
      target - The target of the metric (i.e., the event type or an average).
      name - The name of the metric.
      impl - The implementation function.
  • Method Details

    • compute

      public double compute(org.tribuo.anomaly.evaluation.AnomalyMetric.Context context)
      Description copied from interface: EvaluationMetric
      Compute the result of this metric from the input context.
      Specified by:
      compute in interface EvaluationMetric<Event,org.tribuo.anomaly.evaluation.AnomalyMetric.Context>
      Parameters:
      context - The context to use.
      Returns:
      The value of the metric.
    • getTarget

      public MetricTarget<Event> getTarget()
      Description copied from interface: EvaluationMetric
      The target for this metric instance.
      Specified by:
      getTarget in interface EvaluationMetric<Event,org.tribuo.anomaly.evaluation.AnomalyMetric.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<Event,org.tribuo.anomaly.evaluation.AnomalyMetric.Context>
      Returns:
      The name.
    • createContext

      public org.tribuo.anomaly.evaluation.AnomalyMetric.Context createContext(Model<Event> model, List<Prediction<Event>> predictions)
      Description copied from interface: EvaluationMetric
      Creates the context this metric uses to compute it's value.
      Specified by:
      createContext in interface EvaluationMetric<Event,org.tribuo.anomaly.evaluation.AnomalyMetric.Context>
      Parameters:
      model - The model to use.
      predictions - The predictions to use.
      Returns:
      The metric context.