ApproximateInference

Struct ApproximateInference 

Source
pub struct ApproximateInference<'a, R, M, E> { /* private fields */ }
Expand description

An approximate inference engine.

Implementations§

Source§

impl<'a, R, M> ApproximateInference<'a, R, M, ()>

Source

pub const fn new(rng: &'a mut R, model: &'a M) -> Self

Construct a new approximate inference instance.

§Arguments
  • rng - A random number generator.
  • model - A reference to the model to sample from.
§Returns

Return a new approximate inference instance.

Source§

impl<'a, R, M, E> ApproximateInference<'a, R, M, E>

Source

pub const fn with_evidence<T>( self, evidence: &'a T, ) -> ApproximateInference<'a, R, M, T>

Add evidence to the approximate inference instance.

§Arguments
  • evidence - A reference to the evidence.
§Returns

Return a new approximate inference instance with evidence.

Source

pub const fn with_sample_size(self, n: usize) -> Self

Set the sample size for the approximate inference instance.

§Arguments
  • n - The sample size.
§Panics
  • Panics if n is zero.
§Returns

Return a new approximate inference instance with the specified sample size.

Trait Implementations§

Source§

impl<R: Rng> BNInference<CatBN> for ApproximateInference<'_, R, CatBN, <CatBN as BN>::Evidence>

Source§

fn estimate(&self, x: &Set<usize>, z: &Set<usize>) -> <CatBN as BN>::CPD

Estimate the values of x conditioned on z using n samples. Read more
Source§

impl<R: Rng> BNInference<CatBN> for ApproximateInference<'_, R, CatBN, ()>

Source§

fn estimate(&self, x: &Set<usize>, z: &Set<usize>) -> <CatBN as BN>::CPD

Estimate the values of x conditioned on z using n samples. Read more
Source§

impl<R: Rng> BNInference<GaussBN> for ApproximateInference<'_, R, GaussBN, <GaussBN as BN>::Evidence>

Source§

fn estimate(&self, x: &Set<usize>, z: &Set<usize>) -> <GaussBN as BN>::CPD

Estimate the values of x conditioned on z using n samples. Read more
Source§

impl<R: Rng> BNInference<GaussBN> for ApproximateInference<'_, R, GaussBN, ()>

Source§

fn estimate(&self, x: &Set<usize>, z: &Set<usize>) -> <GaussBN as BN>::CPD

Estimate the values of x conditioned on z using n samples. Read more
Source§

impl<'a, R: Debug, M: Debug, E: Debug> Debug for ApproximateInference<'a, R, M, E>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<R, M, E> Modelled<M> for ApproximateInference<'_, R, M, E>

Source§

fn model(&self) -> &M

Get the model. Read more
Source§

impl<R: Rng + SeedableRng> ParBNInference<CatBN> for ApproximateInference<'_, R, CatBN, <CatBN as BN>::Evidence>

Source§

fn par_estimate(&self, x: &Set<usize>, z: &Set<usize>) -> <CatBN as BN>::CPD

Estimate the values of x conditioned on z using n samples, in parallel. Read more
Source§

impl<R: Rng + SeedableRng> ParBNInference<CatBN> for ApproximateInference<'_, R, CatBN, ()>

Source§

fn par_estimate(&self, x: &Set<usize>, z: &Set<usize>) -> <CatBN as BN>::CPD

Estimate the values of x conditioned on z using n samples, in parallel. Read more
Source§

impl<R: Rng + SeedableRng> ParBNInference<GaussBN> for ApproximateInference<'_, R, GaussBN, <GaussBN as BN>::Evidence>

Source§

fn par_estimate(&self, x: &Set<usize>, z: &Set<usize>) -> <GaussBN as BN>::CPD

Estimate the values of x conditioned on z using n samples, in parallel. Read more
Source§

impl<R: Rng + SeedableRng> ParBNInference<GaussBN> for ApproximateInference<'_, R, GaussBN, ()>

Source§

fn par_estimate(&self, x: &Set<usize>, z: &Set<usize>) -> <GaussBN as BN>::CPD

Estimate the values of x conditioned on z using n samples, in parallel. Read more

Auto Trait Implementations§

§

impl<'a, R, M, E> !Freeze for ApproximateInference<'a, R, M, E>

§

impl<'a, R, M, E> !RefUnwindSafe for ApproximateInference<'a, R, M, E>

§

impl<'a, R, M, E> Send for ApproximateInference<'a, R, M, E>
where M: Sync, R: Send, E: Sync,

§

impl<'a, R, M, E> !Sync for ApproximateInference<'a, R, M, E>

§

impl<'a, R, M, E> Unpin for ApproximateInference<'a, R, M, E>

§

impl<'a, R, M, E> !UnwindSafe for ApproximateInference<'a, R, M, E>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,