java.lang.Object
org.elasticsearch.xpack.core.ml.inference.trainedmodel.ensemble.WeightedSum
All Implemented Interfaces:
org.apache.lucene.util.Accountable, NamedWriteable, Writeable, org.elasticsearch.xcontent.ToXContent, org.elasticsearch.xcontent.ToXContentObject, LenientlyParsedOutputAggregator, OutputAggregator, StrictlyParsedOutputAggregator, NamedXContentObject

public class WeightedSum extends Object implements StrictlyParsedOutputAggregator, LenientlyParsedOutputAggregator
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent

    org.elasticsearch.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.xcontent.ToXContent.MapParams, org.elasticsearch.xcontent.ToXContent.Params

    Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable

    Writeable.Reader<V>, Writeable.Writer<V>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.elasticsearch.xcontent.ParseField
     
    static final org.elasticsearch.xcontent.ParseField
     

    Fields inherited from interface org.apache.lucene.util.Accountable

    NULL_ACCOUNTABLE

    Fields inherited from interface org.elasticsearch.xcontent.ToXContent

    EMPTY, EMPTY_PARAMS
  • Constructor Summary

    Constructors
    Constructor
    Description
    WeightedSum(double[] weights)
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    aggregate(double[] values)
    Function to aggregate the processed values into a single double This may be as simple as returning the index of the maximum value.
    boolean
     
    boolean
     
     
    fromXContentLenient(org.elasticsearch.xcontent.XContentParser parser)
     
    fromXContentStrict(org.elasticsearch.xcontent.XContentParser parser)
     
     
     
    int
     
    double[]
    processValues(double[][] values)
    This pre-processes the values so that they may be passed directly to the OutputAggregator.aggregate(double[]) method.
    long
     
    org.elasticsearch.xcontent.XContentBuilder
    toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params)
     
    void
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.lucene.util.Accountable

    getChildResources

    Methods inherited from interface org.elasticsearch.xcontent.ToXContentObject

    isFragment
  • Field Details

    • NAME

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

      public static final org.elasticsearch.xcontent.ParseField WEIGHTS
  • Constructor Details

  • Method Details

    • fromXContentStrict

      public static WeightedSum fromXContentStrict(org.elasticsearch.xcontent.XContentParser parser)
    • fromXContentLenient

      public static WeightedSum fromXContentLenient(org.elasticsearch.xcontent.XContentParser parser)
    • processValues

      public double[] processValues(double[][] values)
      Description copied from interface: OutputAggregator
      This pre-processes the values so that they may be passed directly to the OutputAggregator.aggregate(double[]) method. Two major types of pre-processed values could be returned: - The confidence/probability scaled values given the input values (See: WeightedMode.processValues(double[][]) - A simple transformation of the passed values in preparation for aggregation (See: processValues(double[][])
      Specified by:
      processValues in interface OutputAggregator
      Parameters:
      values - the values to process
      Returns:
      A new list containing the processed values or the same list if no processing is required
    • aggregate

      public double aggregate(double[] values)
      Description copied from interface: OutputAggregator
      Function to aggregate the processed values into a single double This may be as simple as returning the index of the maximum value. Or as complex as a mathematical reduction of all the passed values (i.e. summation, average, etc.).
      Specified by:
      aggregate in interface OutputAggregator
      Parameters:
      values - The values to aggregate
      Returns:
      the aggregated value.
    • getName

      public String getName()
      Specified by:
      getName in interface NamedXContentObject
      Specified by:
      getName in interface OutputAggregator
      Returns:
      The name of the output aggregator
    • getWriteableName

      public String getWriteableName()
      Specified by:
      getWriteableName in interface NamedWriteable
    • 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
    • equals

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

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

      public Integer expectedValueSize()
      Specified by:
      expectedValueSize in interface OutputAggregator
      Returns:
      The expected size of the values array when aggregating. `null` implies there is no expected size.
    • compatibleWith

      public boolean compatibleWith(TargetType targetType)
      Specified by:
      compatibleWith in interface OutputAggregator
    • ramBytesUsed

      public long ramBytesUsed()
      Specified by:
      ramBytesUsed in interface org.apache.lucene.util.Accountable