Package org.tribuo.anomaly.evaluation
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.tribuo.evaluation.metrics.EvaluationMetric
EvaluationMetric.Average
-
Constructor Summary
ConstructorDescriptionAnomalyMetric
(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. -
Method Summary
Modifier and TypeMethodDescriptiondouble
compute
(org.tribuo.anomaly.evaluation.AnomalyMetric.Context context) Compute the result of this metric from the input context.org.tribuo.anomaly.evaluation.AnomalyMetric.Context
createContext
(Model<Event> model, List<Prediction<Event>> predictions) Creates the context this metric uses to compute it's value.getName()
The name of this metric.The target for this metric instance.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.tribuo.evaluation.metrics.EvaluationMetric
createContext, getID
-
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 interfaceEvaluationMetric<Event,
org.tribuo.anomaly.evaluation.AnomalyMetric.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<Event,
org.tribuo.anomaly.evaluation.AnomalyMetric.Context> - Returns:
- The metric target.
-
getName
Description copied from interface:EvaluationMetric
The name of this metric.- Specified by:
getName
in interfaceEvaluationMetric<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 interfaceEvaluationMetric<Event,
org.tribuo.anomaly.evaluation.AnomalyMetric.Context> - Parameters:
model
- The model to use.predictions
- The predictions to use.- Returns:
- The metric context.
-