Class MutualInformation
java.lang.Object
org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic
org.elasticsearch.search.aggregations.bucket.significant.heuristics.NXYSignificanceHeuristic
org.elasticsearch.search.aggregations.bucket.significant.heuristics.MutualInformation
- All Implemented Interfaces:
NamedWriteable
,Writeable
,ToXContent
,ToXContentFragment
public class MutualInformation extends NXYSignificanceHeuristic
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MutualInformation.MutualInformationBuilder
Nested classes/interfaces inherited from class org.elasticsearch.search.aggregations.bucket.significant.heuristics.NXYSignificanceHeuristic
NXYSignificanceHeuristic.Frequencies, NXYSignificanceHeuristic.NXYBuilder
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, 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 java.lang.String
NAME
static ConstructingObjectParser<MutualInformation,java.lang.Void>
PARSER
Fields inherited from class org.elasticsearch.search.aggregations.bucket.significant.heuristics.NXYSignificanceHeuristic
BACKGROUND_IS_SUPERSET, backgroundIsSuperset, INCLUDE_NEGATIVES_FIELD, includeNegatives, SCORE_ERROR_MESSAGE
-
Constructor Summary
Constructors Constructor Description MutualInformation(boolean includeNegatives, boolean backgroundIsSuperset)
MutualInformation(StreamInput in)
Read from a stream. -
Method Summary
Modifier and Type Method Description boolean
equals(java.lang.Object other)
double
getScore(long subsetFreq, long subsetSize, long supersetFreq, long supersetSize)
Calculates mutual information see "Information Retrieval", Manning et al., Eq.java.lang.String
getWriteableName()
Returns the name of the writeable objectint
hashCode()
XContentBuilder
toXContent(XContentBuilder builder, ToXContent.Params params)
Methods inherited from class org.elasticsearch.search.aggregations.bucket.significant.heuristics.NXYSignificanceHeuristic
build, buildFromParsedArgs, checkFrequencies, computeNxys, declareParseFields, writeTo
Methods inherited from class org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic
checkFrequencyValidity, rewrite, rewrite
-
Field Details
-
NAME
public static final java.lang.String NAME- See Also:
- Constant Field Values
-
PARSER
-
-
Constructor Details
-
MutualInformation
public MutualInformation(boolean includeNegatives, boolean backgroundIsSuperset) -
MutualInformation
Read from a stream.- Throws:
java.io.IOException
-
-
Method Details
-
equals
public boolean equals(java.lang.Object other)- 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 mutual information see "Information Retrieval", Manning et al., Eq. 13.17- 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
public java.lang.String getWriteableName()Description copied from interface:NamedWriteable
Returns the name of the writeable object -
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException- Throws:
java.io.IOException
-