Skip to main content

derive_log_likelihood

Function derive_log_likelihood 

Source
pub fn derive_log_likelihood(base_log_q4: i32, mt: MatchType) -> i32
Expand description

Q4 log-likelihood derived from a match-type classification.

base_log_q4 is the producer-chosen per-engine / per-kind likelihood floor (already in Q4 log-space) — e.g. Q4·ln(LIKELIHOOD_JP_JUKUGO_BASE). The match-type decay is applied on top:

  • Exactbase_log_q4
  • Prefix(prox_milli)base_log_q4 + K · Q4·ln(prox/1000) with K=3
  • Fuzzy(cost_milli)base_log_q4 + Q4·ln(1 − cost/1000) (cost-capped at 999 to avoid -inf)
  • Composed { links }base_log_q4 + (links − 1) · Q4·ln(0.7) for links ≥ 1, else base_log_q4

All decays are non-positive (multiplicative factors ≤ 1.0 in linear space), so the returned value is always ≤ base_log_q4. This is the log-space equivalent of the v1.3 multiplicative chain base · proximity^K · (1 − cost) · 0.7^(links − 1).