pub struct BayesianBM25Params {
pub bm25: BM25Params,
pub alpha: f64,
pub beta: f64,
pub base_rate: f64,
pub calibration_tokens: f64,
pub beta_slope: f64,
pub sigma_slope: f64,
}Fields§
§bm25: BM25Params§alpha: f64§beta: f64§base_rate: f64Corpus relevance prior in [0, 1); zero means “not estimated”.
The prior never enters the posterior transform (which matches
Lucene’s BayesianScoreQuery exactly); it is metadata for
fusion, where it converts posteriors to evidence and enters the
fused score exactly once.
calibration_tokens: f64Query length (analyzed term count) the calibration was fitted at. Zero disables query-length scaling, so hand-written and learner-fitted parameters apply verbatim.
beta_slope: f64Fitted per-token slope of the sigmoid midpoint: raw BM25 sums
grow with the number of query terms, and beta must track that
scale for the posterior to stay in its linear region.
sigma_slope: f64Fitted per-token slope of the score spread (1 / alpha).
Implementations§
Source§impl BayesianBM25Params
impl BayesianBM25Params
Sourcepub fn evidence_params(&self) -> Self
pub fn evidence_params(&self) -> Self
Parameters whose posterior equals this calibration’s prior-free
evidence sigmoid(alpha * (raw - beta) - logit(base_rate)),
expressed through the equivalent midpoint shift
beta + logit(base_rate) / alpha. With no estimated prior the
calibration is returned unchanged.
Sourcepub fn scaled_for_query_terms(&self, term_count: usize) -> Self
pub fn scaled_for_query_terms(&self, term_count: usize) -> Self
The calibration translated to a query with term_count analyzed
terms. Raw BM25 query scores are sums over query terms, so both
the midpoint and the spread of the matching-score distribution
move with the term count; the estimator fits those slopes and
this method applies them:
beta_q = beta + beta_slope * (q - q_ref)
sigma_q = max(sigma_ref + sigma_slope * (q - q_ref), floor)
Parameters without a fitted reference length (or a zero term count) are returned unchanged. Scaling happens per query, never per document, so within-query ranking stays monotone in the raw score.
Trait Implementations§
Source§impl Clone for BayesianBM25Params
impl Clone for BayesianBM25Params
Source§fn clone(&self) -> BayesianBM25Params
fn clone(&self) -> BayesianBM25Params
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more