java.lang.Object
org.elasticsearch.xpack.core.ml.dataframe.evaluation.outlierdetection.Precision
All Implemented Interfaces:
NamedWriteable, Writeable, org.elasticsearch.xcontent.ToXContent, org.elasticsearch.xcontent.ToXContentObject, EvaluationMetric

public class Precision extends Object
  • Field Details

    • NAME

      public static final org.elasticsearch.xcontent.ParseField NAME
    • AT

      public static final org.elasticsearch.xcontent.ParseField AT
    • thresholds

      protected final double[] thresholds
  • Constructor Details

  • Method Details

    • fromXContent

      public static Precision fromXContent(org.elasticsearch.xcontent.XContentParser parser)
    • getWriteableName

      public String getWriteableName()
    • getName

      public String getName()
      Description copied from interface: EvaluationMetric
      Returns the name of the metric (which may differ to the writeable name)
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • aggsAt

      protected List<AggregationBuilder> aggsAt(String actualField, String predictedProbabilityField)
    • evaluate

      public EvaluationMetricResult evaluate(Aggregations aggs)
    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • toXContent

      public org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface org.elasticsearch.xcontent.ToXContent
      Throws:
      IOException
    • getRequiredFields

      public Set<String> getRequiredFields()
      Description copied from interface: EvaluationMetric
      Returns the set of fields that this metric requires in order to be calculated.
      Specified by:
      getRequiredFields in interface EvaluationMetric
    • aggs

      public org.elasticsearch.core.Tuple<List<AggregationBuilder>,List<PipelineAggregationBuilder>> aggs(EvaluationParameters parameters, EvaluationFields fields)
      Description copied from interface: EvaluationMetric
      Builds the aggregation that collect required data to compute the metric
      Specified by:
      aggs in interface EvaluationMetric
      Parameters:
      parameters - settings that may be needed by aggregations
      fields - fields that may be needed by aggregations
      Returns:
      the aggregations required to compute the metric
    • process

      public void process(Aggregations aggs)
      Description copied from interface: EvaluationMetric
      Processes given aggregations as a step towards computing result
      Specified by:
      process in interface EvaluationMetric
      Parameters:
      aggs - aggregations from SearchResponse
    • getResult

      public Optional<EvaluationMetricResult> getResult()
      Description copied from interface: EvaluationMetric
      Gets the evaluation result for this metric.
      Specified by:
      getResult in interface EvaluationMetric
      Returns:
      Optional.empty() if the result is not available yet, Optional.of(result) otherwise
    • aggName

      protected String aggName(double threshold, org.elasticsearch.xpack.core.ml.dataframe.evaluation.outlierdetection.AbstractConfusionMatrixMetric.Condition condition)
    • buildAgg

      protected AggregationBuilder buildAgg(String actualField, String predictedProbabilityField, double threshold, org.elasticsearch.xpack.core.ml.dataframe.evaluation.outlierdetection.AbstractConfusionMatrixMetric.Condition condition)