pub struct BayesianShrinkagePrior {
pub prior_mean: f64,
pub prior_variance: f64,
}Expand description
Prior distribution parameters for Bayesian shrinkage estimation.
Uses a normal prior N(prior_mean, prior_variance) that pulls empirical estimates toward the prior when sample size is small or variance is high.
Fields§
§prior_mean: f64Prior mean for the loss value.
prior_variance: f64Prior variance (τ₀²) - controls how strongly we trust the prior. Smaller values mean stronger pull toward prior_mean.
Implementations§
Source§impl BayesianShrinkagePrior
impl BayesianShrinkagePrior
Sourcepub const fn for_false_negative() -> Self
pub const fn for_false_negative() -> Self
Default prior for false-negative loss (allowing incompatible operation).
Sourcepub const fn for_validate_cost() -> Self
pub const fn for_validate_cost() -> Self
Default prior for validation cost.
Sourcepub const fn for_false_positive() -> Self
pub const fn for_false_positive() -> Self
Default prior for false-positive loss (rejecting compatible operation).
Sourcepub fn shrinkage_weight(
&self,
empirical_variance: f64,
sample_count: usize,
) -> f64
pub fn shrinkage_weight( &self, empirical_variance: f64, sample_count: usize, ) -> f64
Compute shrinkage weight given empirical variance and sample count.
w = τ₀² / (τ₀² + σ²/n)
When n is small or σ² is large, w is small (trust prior more). When n is large and σ² is small, w approaches 1 (trust data more).
Trait Implementations§
Source§impl Clone for BayesianShrinkagePrior
impl Clone for BayesianShrinkagePrior
Source§fn clone(&self) -> BayesianShrinkagePrior
fn clone(&self) -> BayesianShrinkagePrior
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for BayesianShrinkagePrior
Source§impl Debug for BayesianShrinkagePrior
impl Debug for BayesianShrinkagePrior
Source§impl PartialEq for BayesianShrinkagePrior
impl PartialEq for BayesianShrinkagePrior
Source§fn eq(&self, other: &BayesianShrinkagePrior) -> bool
fn eq(&self, other: &BayesianShrinkagePrior) -> bool
self and other values to be equal, and is used by ==.