Mixture

Struct Mixture 

Source
pub struct Mixture<W, M>(/* private fields */)
where
    W: AliasableWeight;
Expand description

Combines multiple moves into a single mixture

Mixtures are constructed from tuples of (Move, Weight) pairs.

For each step, a single move is selected to determine the next proposal. The probability of selecting a given move is determined by its relative weight.

let move_ = Mixture::from((
    (Stretch::default(), 2),
    (RandomGaussian::new(1.0e-3), 1),
));

let (chain, accepted) = sample(&model, &move_, walkers, MinChainLen(100_000), Serial);

Trait Implementations§

Source§

impl<W, A, B> From<((A, W), (B, W))> for Mixture<W, (A, B)>
where W: AliasableWeight,

Source§

fn from(((A, a), (B, b)): ((A, W), (B, W))) -> Self

Converts to this type from the input type.
Source§

impl<W, A, B, C> From<((A, W), (B, W), (C, W))> for Mixture<W, (A, B, C)>
where W: AliasableWeight,

Source§

fn from(((A, a), (B, b), (C, c)): ((A, W), (B, W), (C, W))) -> Self

Converts to this type from the input type.
Source§

impl<W, A, B, C, D> From<((A, W), (B, W), (C, W), (D, W))> for Mixture<W, (A, B, C, D)>
where W: AliasableWeight,

Source§

fn from( ((A, a), (B, b), (C, c), (D, d)): ((A, W), (B, W), (C, W), (D, W)), ) -> Self

Converts to this type from the input type.
Source§

impl<W, A, B, C, D, E> From<((A, W), (B, W), (C, W), (D, W), (E, W))> for Mixture<W, (A, B, C, D, E)>
where W: AliasableWeight,

Source§

fn from( ((A, a), (B, b), (C, c), (D, d), (E, e)): ((A, W), (B, W), (C, W), (D, W), (E, W)), ) -> Self

Converts to this type from the input type.
Source§

impl<W, A, B, C, D, E, F> From<((A, W), (B, W), (C, W), (D, W), (E, W), (F, W))> for Mixture<W, (A, B, C, D, E, F)>
where W: AliasableWeight,

Source§

fn from( ((A, a), (B, b), (C, c), (D, d), (E, e), (F, f)): ((A, W), (B, W), (C, W), (D, W), (E, W), (F, W)), ) -> Self

Converts to this type from the input type.
Source§

impl<W, A, B, C, D, E, F, G> From<((A, W), (B, W), (C, W), (D, W), (E, W), (F, W), (G, W))> for Mixture<W, (A, B, C, D, E, F, G)>
where W: AliasableWeight,

Source§

fn from( ((A, a), (B, b), (C, c), (D, d), (E, e), (F, f), (G, g)): ((A, W), (B, W), (C, W), (D, W), (E, W), (F, W), (G, W)), ) -> Self

Converts to this type from the input type.
Source§

impl<W, A, B, C, D, E, F, G, H> From<((A, W), (B, W), (C, W), (D, W), (E, W), (F, W), (G, W), (H, W))> for Mixture<W, (A, B, C, D, E, F, G, H)>
where W: AliasableWeight,

Source§

fn from( ((A, a), (B, b), (C, c), (D, d), (E, e), (F, f), (G, g), (H, h)): ((A, W), (B, W), (C, W), (D, W), (E, W), (F, W), (G, W), (H, W)), ) -> Self

Converts to this type from the input type.
Source§

impl<W, A, B, C, D, E, F, G, H, I> From<((A, W), (B, W), (C, W), (D, W), (E, W), (F, W), (G, W), (H, W), (I, W))> for Mixture<W, (A, B, C, D, E, F, G, H, I)>
where W: AliasableWeight,

Source§

fn from( ((A, a), (B, b), (C, c), (D, d), (E, e), (F, f), (G, g), (H, h), (I, i)): ((A, W), (B, W), (C, W), (D, W), (E, W), (F, W), (G, W), (H, W), (I, W)), ) -> Self

Converts to this type from the input type.
Source§

impl<W, A, B, C, D, E, F, G, H, I, J> From<((A, W), (B, W), (C, W), (D, W), (E, W), (F, W), (G, W), (H, W), (I, W), (J, W))> for Mixture<W, (A, B, C, D, E, F, G, H, I, J)>
where W: AliasableWeight,

Source§

fn from( ((A, a), (B, b), (C, c), (D, d), (E, e), (F, f), (G, g), (H, h), (I, i), (J, j)): ((A, W), (B, W), (C, W), (D, W), (E, W), (F, W), (G, W), (H, W), (I, W), (J, W)), ) -> Self

Converts to this type from the input type.
Source§

impl<W, A, B, P> Move<P> for Mixture<W, (A, B)>
where W: AliasableWeight, P: Params, A: Move<P>, B: Move<P>,

Source§

fn propose<'a, O, R>(&self, this: &'a P, other: O, rng: &mut R) -> (P, f64)
where O: FnMut(&mut R) -> &'a P, R: Rng,

Propose new estimates of the model parameters Read more
Source§

impl<W, A, B, C, P> Move<P> for Mixture<W, (A, B, C)>
where W: AliasableWeight, P: Params, A: Move<P>, B: Move<P>, C: Move<P>,

Source§

fn propose<'a, O, R>(&self, this: &'a P, other: O, rng: &mut R) -> (P, f64)
where O: FnMut(&mut R) -> &'a P, R: Rng,

Propose new estimates of the model parameters Read more
Source§

impl<W, A, B, C, D, P> Move<P> for Mixture<W, (A, B, C, D)>
where W: AliasableWeight, P: Params, A: Move<P>, B: Move<P>, C: Move<P>, D: Move<P>,

Source§

fn propose<'a, O, R>(&self, this: &'a P, other: O, rng: &mut R) -> (P, f64)
where O: FnMut(&mut R) -> &'a P, R: Rng,

Propose new estimates of the model parameters Read more
Source§

impl<W, A, B, C, D, E, P> Move<P> for Mixture<W, (A, B, C, D, E)>
where W: AliasableWeight, P: Params, A: Move<P>, B: Move<P>, C: Move<P>, D: Move<P>, E: Move<P>,

Source§

fn propose<'a, O, R>(&self, this: &'a P, other: O, rng: &mut R) -> (P, f64)
where O: FnMut(&mut R) -> &'a P, R: Rng,

Propose new estimates of the model parameters Read more
Source§

impl<W, A, B, C, D, E, F, P> Move<P> for Mixture<W, (A, B, C, D, E, F)>
where W: AliasableWeight, P: Params, A: Move<P>, B: Move<P>, C: Move<P>, D: Move<P>, E: Move<P>, F: Move<P>,

Source§

fn propose<'a, O, R>(&self, this: &'a P, other: O, rng: &mut R) -> (P, f64)
where O: FnMut(&mut R) -> &'a P, R: Rng,

Propose new estimates of the model parameters Read more
Source§

impl<W, A, B, C, D, E, F, G, P> Move<P> for Mixture<W, (A, B, C, D, E, F, G)>
where W: AliasableWeight, P: Params, A: Move<P>, B: Move<P>, C: Move<P>, D: Move<P>, E: Move<P>, F: Move<P>, G: Move<P>,

Source§

fn propose<'a, O, R>(&self, this: &'a P, other: O, rng: &mut R) -> (P, f64)
where O: FnMut(&mut R) -> &'a P, R: Rng,

Propose new estimates of the model parameters Read more
Source§

impl<W, A, B, C, D, E, F, G, H, P> Move<P> for Mixture<W, (A, B, C, D, E, F, G, H)>
where W: AliasableWeight, P: Params, A: Move<P>, B: Move<P>, C: Move<P>, D: Move<P>, E: Move<P>, F: Move<P>, G: Move<P>, H: Move<P>,

Source§

fn propose<'a, O, R>(&self, this: &'a P, other: O, rng: &mut R) -> (P, f64)
where O: FnMut(&mut R) -> &'a P, R: Rng,

Propose new estimates of the model parameters Read more
Source§

impl<W, A, B, C, D, E, F, G, H, I, P> Move<P> for Mixture<W, (A, B, C, D, E, F, G, H, I)>
where W: AliasableWeight, P: Params, A: Move<P>, B: Move<P>, C: Move<P>, D: Move<P>, E: Move<P>, F: Move<P>, G: Move<P>, H: Move<P>, I: Move<P>,

Source§

fn propose<'a, O, R>(&self, this: &'a P, other: O, rng: &mut R) -> (P, f64)
where O: FnMut(&mut R) -> &'a P, R: Rng,

Propose new estimates of the model parameters Read more
Source§

impl<W, A, B, C, D, E, F, G, H, I, J, P> Move<P> for Mixture<W, (A, B, C, D, E, F, G, H, I, J)>
where W: AliasableWeight, P: Params, A: Move<P>, B: Move<P>, C: Move<P>, D: Move<P>, E: Move<P>, F: Move<P>, G: Move<P>, H: Move<P>, I: Move<P>, J: Move<P>,

Source§

fn propose<'a, O, R>(&self, this: &'a P, other: O, rng: &mut R) -> (P, f64)
where O: FnMut(&mut R) -> &'a P, R: Rng,

Propose new estimates of the model parameters Read more

Auto Trait Implementations§

§

impl<W, M> Freeze for Mixture<W, M>
where M: Freeze, <W as SampleUniform>::Sampler: Freeze,

§

impl<W, M> RefUnwindSafe for Mixture<W, M>

§

impl<W, M> Send for Mixture<W, M>
where M: Send, <W as SampleUniform>::Sampler: Send, W: Send,

§

impl<W, M> Sync for Mixture<W, M>
where M: Sync, <W as SampleUniform>::Sampler: Sync, W: Sync,

§

impl<W, M> Unpin for Mixture<W, M>
where M: Unpin, <W as SampleUniform>::Sampler: Unpin,

§

impl<W, M> UnwindSafe for Mixture<W, M>

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.