Module org.elasticsearch.xcore
Class AbstractAucRoc
java.lang.Object
org.elasticsearch.xpack.core.ml.dataframe.evaluation.common.AbstractAucRoc
- All Implemented Interfaces:
NamedWriteable,Writeable,org.elasticsearch.xcontent.ToXContent,org.elasticsearch.xcontent.ToXContentObject,EvaluationMetric
Area under the curve (AUC) of the receiver operating characteristic (ROC).
The ROC curve is a plot of the TPR (true positive rate) against
the FPR (false positive rate) over a varying threshold.
This particular implementation is making use of ES aggregations
to calculate the curve. It then uses the trapezoidal rule to calculate
the AUC.
In particular, in order to calculate the ROC, we get percentiles of TP
and FP against the predicted probability. We call those Rate-Threshold
curves. We then scan ROC points from each Rate-Threshold curve against the
other using interpolation. This gives us an approximation of the ROC curve
that has the advantage of being efficient and resilient to some edge cases.
When this is used for multi-class classification, it will calculate the ROC
curve of each class versus the rest.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic classNested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
org.elasticsearch.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.xcontent.ToXContent.MapParams, org.elasticsearch.xcontent.ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static List<AbstractAucRoc.AucRocPoint> buildAucRocCurve(double[] tpPercentiles, double[] fpPercentiles) Visible for testingprotected static doublecalculateAucScore(List<AbstractAucRoc.AucRocPoint> rocCurve) Visible for testinggetName()Returns the name of the metric (which may differ to the writeable name)protected static double[]percentilesArray(Percentiles percentiles) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.xpack.core.ml.dataframe.evaluation.EvaluationMetric
aggs, getRequiredFields, getResult, processMethods inherited from interface org.elasticsearch.common.io.stream.NamedWriteable
getWriteableNameMethods inherited from interface org.elasticsearch.xcontent.ToXContent
toXContentMethods inherited from interface org.elasticsearch.xcontent.ToXContentObject
isFragment
-
Field Details
-
NAME
public static final org.elasticsearch.xcontent.ParseField NAME
-
-
Constructor Details
-
AbstractAucRoc
protected AbstractAucRoc()
-
-
Method Details
-
getName
Description copied from interface:EvaluationMetricReturns the name of the metric (which may differ to the writeable name)- Specified by:
getNamein interfaceEvaluationMetric
-
percentilesArray
-
buildAucRocCurve
protected static List<AbstractAucRoc.AucRocPoint> buildAucRocCurve(double[] tpPercentiles, double[] fpPercentiles) Visible for testing -
calculateAucScore
Visible for testing
-