public class IBSimilarity extends SimilarityBase
The retrieval function is of the form RSV(q, d) = ∑ -xqw log Prob(Xw ≥ tdw | λw), where
The framework described in the paper has many similarities to the DFR
framework (see DFRSimilarity
). It is possible that the two
Similarities will be merged at one point.
To construct an IBSimilarity, you must specify the implementations for all three components of the Information-Based model.
Distribution
: Probabilistic distribution used to
model term occurrence
DistributionLL
: Log-logisticDistributionLL
: Smoothed power-lawLambda
: λw parameter of the
probability distribution
Normalization
: Term frequency normalization
Any supported DFR normalization (listed in
DFRSimilarity
)
DFRSimilarity
Similarity.SimScorer
Modifier and Type | Field and Description |
---|---|
protected Distribution |
distribution
The probabilistic distribution used to model term occurrence.
|
protected Lambda |
lambda
The lambda (λw) parameter.
|
protected Normalization |
normalization
The term frequency normalization.
|
discountOverlaps
Constructor and Description |
---|
IBSimilarity(Distribution distribution,
Lambda lambda,
Normalization normalization)
Creates IBSimilarity from the three components.
|
Modifier and Type | Method and Description |
---|---|
protected Explanation |
explain(BasicStats stats,
Explanation freq,
double docLen)
Explains the score.
|
protected void |
explain(List<Explanation> subs,
BasicStats stats,
double freq,
double docLen)
Subclasses should implement this method to explain the score.
|
Distribution |
getDistribution()
Returns the distribution
|
Lambda |
getLambda()
Returns the distribution's lambda parameter
|
Normalization |
getNormalization()
Returns the term frequency normalization
|
protected double |
score(BasicStats stats,
double freq,
double docLen)
Scores the document
doc . |
String |
toString()
The name of IB methods follow the pattern
IB <distribution> <lambda><normalization> . |
computeNorm, fillBasicStats, getDiscountOverlaps, log2, newStats, scorer, setDiscountOverlaps
protected final Distribution distribution
protected final Lambda lambda
protected final Normalization normalization
public IBSimilarity(Distribution distribution, Lambda lambda, Normalization normalization)
Note that null
values are not allowed:
if you want no normalization, instead pass
Normalization.NoNormalization
.
distribution
- probabilistic distribution modeling term occurrencelambda
- distribution's λw parameternormalization
- term frequency normalizationprotected double score(BasicStats stats, double freq, double docLen)
SimilarityBase
doc
.
Subclasses must apply their scoring formula in this class.
score
in class SimilarityBase
stats
- the corpus level statistics.freq
- the term frequency.docLen
- the document length.protected void explain(List<Explanation> subs, BasicStats stats, double freq, double docLen)
SimilarityBase
expl
already contains the score, the name of the class and the doc id, as well
as the term frequency and its explanation; subclasses can add additional
clauses to explain details of their scoring formulae.
The default implementation does nothing.
explain
in class SimilarityBase
subs
- the list of details of the explanation to extendstats
- the corpus level statistics.freq
- the term frequency.docLen
- the document length.protected Explanation explain(BasicStats stats, Explanation freq, double docLen)
SimilarityBase
SimilarityBase.score(BasicStats, double, double)
method) and the explanation for the term frequency. Subclasses content with
this format may add additional details in
SimilarityBase.explain(List, BasicStats, double, double)
.explain
in class SimilarityBase
stats
- the corpus level statistics.freq
- the term frequency and its explanation.docLen
- the document length.public String toString()
IB <distribution> <lambda><normalization>
. The name of the
distribution is the same as in the original paper; for the names of lambda
parameters, refer to the javadoc of the Lambda
classes.toString
in class SimilarityBase
public Distribution getDistribution()
public Lambda getLambda()
public Normalization getNormalization()
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.