pub struct PACBayesBound {
pub delta: f64,
pub n_samples: usize,
}Fields§
§delta: f64§n_samples: usizeImplementations§
Source§impl PACBayesBound
impl PACBayesBound
pub fn new(delta: f64, n_samples: usize) -> Self
Sourcepub fn mcallester(&self, empirical_risk: f64, kl_divergence: f64) -> f64
pub fn mcallester(&self, empirical_risk: f64, kl_divergence: f64) -> f64
McAllester 2003 bound: R(Q) <= R_emp(Q) + sqrt( (KL(Q||P) + ln(2sqrt(n)/delta)) / (2n) )
Sourcepub fn catoni(
&self,
empirical_risk: f64,
kl_divergence: f64,
lambda: f64,
) -> f64
pub fn catoni( &self, empirical_risk: f64, kl_divergence: f64, lambda: f64, ) -> f64
Catoni 2007 bound (simplified, lambda-dependent): R(Q) <= (1 - e^{-lambda*R_emp(Q)n}) / lambda + KL(Q||P)/(lambdan)
Sourcepub fn kl_bernoulli(q: f64, p: f64) -> f64
pub fn kl_bernoulli(q: f64, p: f64) -> f64
KL divergence between two Bernoulli distributions (for {0,1} risks)
Trait Implementations§
Source§impl Clone for PACBayesBound
impl Clone for PACBayesBound
Source§fn clone(&self) -> PACBayesBound
fn clone(&self) -> PACBayesBound
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PACBayesBound
impl RefUnwindSafe for PACBayesBound
impl Send for PACBayesBound
impl Sync for PACBayesBound
impl Unpin for PACBayesBound
impl UnsafeUnpin for PACBayesBound
impl UnwindSafe for PACBayesBound
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