pub struct SectionPosteriorState {
pub posteriors: HashMap<SectionType, BetaPosterior>,
pub priors: HashMap<SectionType, BetaPosterior>,
pub total_events: u64,
pub exploration_epoch: u64,
}Expand description
Per-profile section posterior state (ADR-048 Phase 1).
Fields§
§posteriors: HashMap<SectionType, BetaPosterior>§priors: HashMap<SectionType, BetaPosterior>§total_events: u64§exploration_epoch: u64Implementations§
Source§impl SectionPosteriorState
impl SectionPosteriorState
Sourcepub fn from_priors(priors: HashMap<SectionType, BetaPosterior>) -> Self
pub fn from_priors(priors: HashMap<SectionType, BetaPosterior>) -> Self
Create from explicit prior map. Missing sections get neutral Beta(2,2) fallback.
Sourcepub fn default_priors() -> HashMap<SectionType, BetaPosterior>
pub fn default_priors() -> HashMap<SectionType, BetaPosterior>
Default informative priors from ADR-048.
pub fn to_snapshot(&self) -> SectionPosteriorSnapshot
pub fn from_snapshot(snapshot: SectionPosteriorSnapshot) -> Self
Sourcepub fn weights(&self, rng: &mut impl Rng) -> HashMap<SectionType, f64>
pub fn weights(&self, rng: &mut impl Rng) -> HashMap<SectionType, f64>
Thompson sampling weights (stochastic when exploring, deterministic otherwise).
Sourcepub fn sample_weights(&self, rng: &mut impl Rng) -> HashMap<SectionType, f64>
pub fn sample_weights(&self, rng: &mut impl Rng) -> HashMap<SectionType, f64>
Stochastic weights via Thompson sampling + softmax (ADR-048 Correction 1).
Explore mode (exploration_epoch > 0): tau = tau_0 * (exploration_epoch / DEFAULT_EXPLORATION_EPOCH) theta_i ~ Beta(alpha_i, beta_i) via Gamma-ratio method w_i = softmax(theta_i / tau), then floor at DEFAULT_SECTION_WEIGHT_FLOOR + renorm
Exploit mode (exploration_epoch == 0): delegates to deterministic_weights() with tau_exploit = DEFAULT_TAU_EXPLOIT applied over posterior means.
Sourcepub fn deterministic_weights(&self) -> HashMap<SectionType, f64>
pub fn deterministic_weights(&self) -> HashMap<SectionType, f64>
Deterministic weights from posterior means with exploit-mode softmax (ADR-048 Correction 1).
Uses tau_exploit = DEFAULT_TAU_EXPLOIT (0.1) over posterior means, then applies weight floor at DEFAULT_SECTION_WEIGHT_FLOOR and renormalizes.
Sourcepub fn reset_posteriors(&mut self)
pub fn reset_posteriors(&mut self)
Reset posteriors to their stored priors.