
LMAbsoluteDiscountingSimilarity
- Namespace
- Rowles.LeanCorpus.Search.Scoring
- Assembly
- Rowles.LeanCorpus.dll
Language-model similarity with absolute discounting smoothing. Subtracts a constant δ from each observed term count and redistributes the probability mass to unseen terms via the collection model.
Score = log((max(tf - δ, 0) + δ · |d| · P(t|C)) / |d|), where P(t|C) = collectionFrequency / totalTermsInCollection.
Default δ = 0.7.
public sealed class LMAbsoluteDiscountingSimilarity : ISimilarity
- Inheritance
-
LMAbsoluteDiscountingSimilarity
- Implements
LMAbsoluteDiscountingSimilarity(float)
Initialises a new instance with the specified discount parameter δ.
Instance
Gets a shared singleton instance with the default δ = 0.7.
RequiresCollectionStatistics
Whether this similarity requires collection-level statistics (total term frequency and total terms in collection) for scoring.
PrecomputeFactors(int, int, float)
Precomputes factors constant for a given term across all documents.
PrecomputeLmFactors(int, int, float, long, long)
Precomputes factors including collection-level term statistics for language-model similarities. Default simply delegates to PrecomputeFactors(int, int, float) and sets CollectionProb to 0.
Score(int, int, float, int, int)
Computes the score for a single term occurrence in a document.
ScoreLmPrecomputed(float, float, float, int, int)
Scores using precomputed language-model factors.
Default delegates to ScorePrecomputed(float, float, int, int), ignoring collectionProb.
ScorePrecomputed(float, float, int, int)
Scores using precomputed factors for hot-path scoring.