Class DFRSimilarity
- java.lang.Object
-
- org.apache.lucene.search.similarities.Similarity
-
- org.apache.lucene.search.similarities.SimilarityBase
-
- org.apache.lucene.search.similarities.DFRSimilarity
-
public class DFRSimilarity extends SimilarityBase
Implements the divergence from randomness (DFR) framework introduced in Gianni Amati and Cornelis Joost Van Rijsbergen. 2002. Probabilistic models of information retrieval based on measuring the divergence from randomness. ACM Trans. Inf. Syst. 20, 4 (October 2002), 357-389.The DFR scoring formula is composed of three separate components: the basic model, the aftereffect and an additional normalization component, represented by the classes
BasicModel,AfterEffectandNormalization, respectively. The names of these classes were chosen to match the names of their counterparts in the Terrier IR engine.To construct a DFRSimilarity, you must specify the implementations for all three components of DFR:
BasicModel: Basic model of information content:BasicModelBE: Limiting form of Bose-EinsteinBasicModelG: Geometric approximation of Bose-EinsteinBasicModelP: Poisson approximation of the BinomialBasicModelD: Divergence approximation of the BinomialBasicModelIn: Inverse document frequencyBasicModelIne: Inverse expected document frequency [mixture of Poisson and IDF]BasicModelIF: Inverse term frequency [approximation of I(ne)]
AfterEffect: First normalization of information gain:AfterEffectL: Laplace's law of successionAfterEffectB: Ratio of two Bernoulli processesAfterEffect.NoAfterEffect: no first normalization
Normalization: Second (length) normalization:NormalizationH1: Uniform distribution of term frequencyNormalizationH2: term frequency density inversely related to lengthNormalizationH3: term frequency normalization provided by Dirichlet priorNormalizationZ: term frequency normalization provided by a Zipfian relationNormalization.NoNormalization: no second normalization
Note that qtf, the multiplicity of term-occurrence in the query, is not handled by this implementation.
- See Also:
BasicModel,AfterEffect,Normalization
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.lucene.search.similarities.Similarity
Similarity.SimScorer, Similarity.SimWeight
-
-
Constructor Summary
Constructors Constructor Description DFRSimilarity(BasicModel basicModel, AfterEffect afterEffect, Normalization normalization)Creates DFRSimilarity from the three components.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AfterEffectgetAfterEffect()Returns the first normalizationBasicModelgetBasicModel()Returns the basic model of information contentNormalizationgetNormalization()Returns the second normalizationjava.lang.StringtoString()Subclasses must override this method to return the name of the Similarity and preferably the values of parameters (if any) as well.-
Methods inherited from class org.apache.lucene.search.similarities.SimilarityBase
computeNorm, computeWeight, getDiscountOverlaps, log2, setDiscountOverlaps, simScorer
-
Methods inherited from class org.apache.lucene.search.similarities.Similarity
coord, queryNorm
-
-
-
-
Constructor Detail
-
DFRSimilarity
public DFRSimilarity(BasicModel basicModel, AfterEffect afterEffect, Normalization normalization)
Creates DFRSimilarity from the three components.Note that
nullvalues are not allowed: if you want no normalization or after-effect, instead passNormalization.NoNormalizationorAfterEffect.NoAfterEffectrespectively.- Parameters:
basicModel- Basic model of information contentafterEffect- First normalization of information gainnormalization- Second (length) normalization
-
-
Method Detail
-
toString
public java.lang.String toString()
Description copied from class:SimilarityBaseSubclasses must override this method to return the name of the Similarity and preferably the values of parameters (if any) as well.- Specified by:
toStringin classSimilarityBase
-
getBasicModel
public BasicModel getBasicModel()
Returns the basic model of information content
-
getAfterEffect
public AfterEffect getAfterEffect()
Returns the first normalization
-
getNormalization
public Normalization getNormalization()
Returns the second normalization
-
-