Class ChiSquare
java.lang.Object
org.elasticsearch.search.aggregations.bucket.terms.heuristic.SignificanceHeuristic
org.elasticsearch.search.aggregations.bucket.terms.heuristic.NXYSignificanceHeuristic
org.elasticsearch.search.aggregations.bucket.terms.heuristic.ChiSquare
- All Implemented Interfaces:
NamedWriteable
,Writeable
,org.elasticsearch.common.xcontent.ToXContent
,org.elasticsearch.common.xcontent.ToXContentFragment
-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.search.aggregations.bucket.terms.heuristic.NXYSignificanceHeuristic
NXYSignificanceHeuristic.Frequencies, NXYSignificanceHeuristic.NXYBuilder
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Fields inherited from class org.elasticsearch.search.aggregations.bucket.terms.heuristic.NXYSignificanceHeuristic
BACKGROUND_IS_SUPERSET, backgroundIsSuperset, INCLUDE_NEGATIVES_FIELD, includeNegatives, SCORE_ERROR_MESSAGE
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
ConstructorDescriptionChiSquare(boolean includeNegatives, boolean backgroundIsSuperset)
ChiSquare(StreamInput in)
Read from a stream. -
Method Summary
Modifier and TypeMethodDescriptionboolean
double
getScore(long subsetFreq, long subsetSize, long supersetFreq, long supersetSize)
Calculates Chi^2 see "Information Retrieval", Manning et al., Eq.Returns the name of the writeable objectint
hashCode()
org.elasticsearch.common.xcontent.XContentBuilder
toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
Methods inherited from class org.elasticsearch.search.aggregations.bucket.terms.heuristic.NXYSignificanceHeuristic
build, buildFromParsedArgs, checkFrequencies, computeNxys, declareParseFields, writeTo
Methods inherited from class org.elasticsearch.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.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
Field Details
-
NAME
- See Also:
- Constant Field Values
-
PARSER
-
-
Constructor Details
-
ChiSquare
public ChiSquare(boolean includeNegatives, boolean backgroundIsSuperset) -
ChiSquare
Read from a stream.- Throws:
IOException
-
-
Method Details
-
equals
- Overrides:
equals
in classNXYSignificanceHeuristic
-
hashCode
public int hashCode()- Overrides:
hashCode
in classNXYSignificanceHeuristic
-
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 classSignificanceHeuristic
- Parameters:
subsetFreq
- The frequency of the term in the selected samplesubsetSize
- The size of the selected sample (typically number of docs)supersetFreq
- The frequency of the term in the superset from which the sample was takensupersetSize
- The size of the superset from which the sample was taken (typically number of docs)- Returns:
- a "significance" score
-
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 IOException- Throws:
IOException
-