All Implemented Interfaces:
org.opensearch.core.common.io.stream.NamedWriteable, org.opensearch.core.common.io.stream.Writeable, org.opensearch.core.xcontent.ToXContent, org.opensearch.core.xcontent.ToXContentFragment

public class GND extends NXYSignificanceHeuristic
GND significance heuristic for significant terms agg
Opensearch.internal:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Builder for a GND heuristic

    Nested classes/interfaces inherited from class org.opensearch.search.aggregations.bucket.terms.heuristic.NXYSignificanceHeuristic

    NXYSignificanceHeuristic.Frequencies, NXYSignificanceHeuristic.NXYBuilder

    Nested classes/interfaces inherited from interface org.opensearch.core.xcontent.ToXContent

    org.opensearch.core.xcontent.ToXContent.DelegatingMapParams, org.opensearch.core.xcontent.ToXContent.MapParams, org.opensearch.core.xcontent.ToXContent.Params

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

    org.opensearch.core.common.io.stream.Writeable.Reader<V>, org.opensearch.core.common.io.stream.Writeable.WriteableRegistry, org.opensearch.core.common.io.stream.Writeable.Writer<V>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final org.opensearch.core.xcontent.ConstructingObjectParser<GND,Void>
     

    Fields inherited from class org.opensearch.search.aggregations.bucket.terms.heuristic.NXYSignificanceHeuristic

    BACKGROUND_IS_SUPERSET, backgroundIsSuperset, INCLUDE_NEGATIVES_FIELD, includeNegatives, SCORE_ERROR_MESSAGE

    Fields inherited from interface org.opensearch.core.xcontent.ToXContent

    EMPTY_PARAMS
  • Constructor Summary

    Constructors
    Constructor
    Description
    GND(boolean backgroundIsSuperset)
     
    GND(org.opensearch.core.common.io.stream.StreamInput in)
    Read from a stream.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(Object other)
     
    double
    getScore(long subsetFreq, long subsetSize, long supersetFreq, long supersetSize)
    Calculates Google Normalized Distance, as described in "The Google Similarity Distance", Cilibrasi and Vitanyi, 2007 link: http://arxiv.org/pdf/cs/0412098v3.pdf
     
    int
     
    org.opensearch.core.xcontent.XContentBuilder
    toXContent(org.opensearch.core.xcontent.XContentBuilder builder, org.opensearch.core.xcontent.ToXContent.Params params)
     
    void
    writeTo(org.opensearch.core.common.io.stream.StreamOutput out)
     

    Methods inherited from class org.opensearch.search.aggregations.bucket.terms.heuristic.NXYSignificanceHeuristic

    build, buildFromParsedArgs, checkFrequencies, computeNxys, declareParseFields

    Methods inherited from class org.opensearch.search.aggregations.bucket.terms.heuristic.SignificanceHeuristic

    checkFrequencyValidity, rewrite, rewrite

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface org.opensearch.core.xcontent.ToXContentFragment

    isFragment
  • Field Details

    • NAME

      public static final String NAME
      See Also:
    • PARSER

      public static final org.opensearch.core.xcontent.ConstructingObjectParser<GND,Void> PARSER
  • Constructor Details

    • GND

      public GND(boolean backgroundIsSuperset)
    • GND

      public GND(org.opensearch.core.common.io.stream.StreamInput in) throws IOException
      Read from a stream.
      Throws:
      IOException
  • Method Details

    • writeTo

      public void writeTo(org.opensearch.core.common.io.stream.StreamOutput out) throws IOException
      Specified by:
      writeTo in interface org.opensearch.core.common.io.stream.Writeable
      Overrides:
      writeTo in class NXYSignificanceHeuristic
      Throws:
      IOException
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class NXYSignificanceHeuristic
    • getScore

      public double getScore(long subsetFreq, long subsetSize, long supersetFreq, long supersetSize)
      Calculates Google Normalized Distance, as described in "The Google Similarity Distance", Cilibrasi and Vitanyi, 2007 link: http://arxiv.org/pdf/cs/0412098v3.pdf
      Specified by:
      getScore in class SignificanceHeuristic
      Parameters:
      subsetFreq - The frequency of the term in the selected sample
      subsetSize - The size of the selected sample (typically number of docs)
      supersetFreq - The frequency of the term in the superset from which the sample was taken
      supersetSize - The size of the superset from which the sample was taken (typically number of docs)
      Returns:
      a "significance" score
    • getWriteableName

      public String getWriteableName()
    • toXContent

      public org.opensearch.core.xcontent.XContentBuilder toXContent(org.opensearch.core.xcontent.XContentBuilder builder, org.opensearch.core.xcontent.ToXContent.Params params) throws IOException
      Throws:
      IOException