pub struct ImportanceSampler<T, D, PD>where
T: RandomVariable,
D: Distribution<Value = T, Condition = ()>,
PD: Distribution<Value = T, Condition = ()>,{ /* private fields */ }Expand description
Sample b from posterior p(b|a) with likelihood p(a|b) and prior p(b)
Implementations
sourceimpl<T, D, PD> ImportanceSampler<T, D, PD>where
T: RandomVariable,
D: Distribution<Value = T, Condition = ()>,
PD: Distribution<Value = T, Condition = ()>,
impl<T, D, PD> ImportanceSampler<T, D, PD>where
T: RandomVariable,
D: Distribution<Value = T, Condition = ()>,
PD: Distribution<Value = T, Condition = ()>,
pub fn new(distribution: D, proposal: PD) -> Result<Self, DistributionError>
pub fn expectation(
&self,
f: impl Fn(&T) -> f64,
x: &[T]
) -> Result<f64, DistributionError>
Auto Trait Implementations
impl<T, D, PD> RefUnwindSafe for ImportanceSampler<T, D, PD>where
D: RefUnwindSafe,
PD: RefUnwindSafe,
impl<T, D, PD> Send for ImportanceSampler<T, D, PD>
impl<T, D, PD> Sync for ImportanceSampler<T, D, PD>
impl<T, D, PD> Unpin for ImportanceSampler<T, D, PD>where
D: Unpin,
PD: Unpin,
impl<T, D, PD> UnwindSafe for ImportanceSampler<T, D, PD>where
D: UnwindSafe,
PD: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more