All Implemented Interfaces:
NamedWriteable, Writeable, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentFragment

public class ChiSquare
extends NXYSignificanceHeuristic
  • Field Details

    • NAME

      public static final java.lang.String NAME
      See Also:
      Constant Field Values
    • PARSER

      public static final org.elasticsearch.common.xcontent.ConstructingObjectParser<ChiSquare,​java.lang.Void> PARSER
  • Constructor Details

    • ChiSquare

      public ChiSquare​(boolean includeNegatives, boolean backgroundIsSuperset)
    • ChiSquare

      public ChiSquare​(StreamInput in) throws java.io.IOException
      Read from a stream.
      Throws:
      java.io.IOException
  • Method Details

    • equals

      public boolean equals​(java.lang.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 Chi^2 see "Information Retrieval", Manning et al., Eq. 13.19
      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 java.lang.String getWriteableName()
      Description copied from interface: NamedWriteable
      Returns the name of the writeable object
    • toXContent

      public org.elasticsearch.common.xcontent.XContentBuilder toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException
      Throws:
      java.io.IOException