pub struct PACBayesGeneralization {
pub kl_qp: f64,
pub n: usize,
pub delta: f64,
}Expand description
PAC-Bayes generalization bound computation.
McAllester’s bound: L_D(Q) ≤ L_S(Q) + √((KL(Q‖P) + ln(n/δ)) / (2n)).
Fields§
§kl_qp: f64KL divergence KL(Q‖P) in nats.
n: usizeNumber of training samples n.
delta: f64Confidence parameter δ.
Implementations§
Source§impl PACBayesGeneralization
impl PACBayesGeneralization
Sourcepub fn mcallester_bound(&self, empirical_loss: f64) -> f64
pub fn mcallester_bound(&self, empirical_loss: f64) -> f64
McAllester bound: empirical_loss + √((KL + ln(n/δ)) / (2n)).
Sourcepub fn catoni_bound(&self, empirical_loss: f64, lambda: f64) -> f64
pub fn catoni_bound(&self, empirical_loss: f64, lambda: f64) -> f64
Catoni’s tighter bound (using solve for λ-parameterized form). Approximation: L_D(Q) ≤ (1/(1-λ/2)) * (L_S(Q) + KL/(2λn)).
Sourcepub fn optimal_lambda(&self, empirical_loss: f64) -> f64
pub fn optimal_lambda(&self, empirical_loss: f64) -> f64
Optimal λ for Catoni bound (minimizing RHS).
Auto Trait Implementations§
impl Freeze for PACBayesGeneralization
impl RefUnwindSafe for PACBayesGeneralization
impl Send for PACBayesGeneralization
impl Sync for PACBayesGeneralization
impl Unpin for PACBayesGeneralization
impl UnsafeUnpin for PACBayesGeneralization
impl UnwindSafe for PACBayesGeneralization
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more