Struct fetish_lib::normal_inverse_wishart::NormalInverseWishart[][src]

pub struct NormalInverseWishart {
    pub mean: Array2<f32>,
    pub precision_u: Array2<f32>,
    pub precision: Array2<f32>,
    pub sigma: Array2<f32>,
    pub big_v: Array2<f32>,
    pub little_v: f32,
    pub t: usize,
    pub s: usize,
}
Expand description

Matrix-normal-inverse-wishart distribution representation for bayesian inference

Fields

mean: Array2<f32>precision_u: Array2<f32>
Expand description

This is always maintained to equal mean.dot(&precision)

precision: Array2<f32>sigma: Array2<f32>
Expand description

This is always maintained to equal pseudoinverse_h(&precision)

big_v: Array2<f32>little_v: f32t: usize
Expand description

The output dimensionality

s: usize
Expand description

The input dimensionality

Implementations

impl NormalInverseWishart[src]

pub fn recompute_derived(&mut self)[src]

Manually re-computes self.sigma and self.precision_u to align with their definitions based on the other fields in self. This method takes cubic time, so it’s not recommended to call this unless you observe issues with these fields accumulating numerical errors away from what they should be.

pub fn get_total_dims(&self) -> usize[src]

Gets the total dimensionality of self.mean.

pub fn sample(&self, rng: &mut ThreadRng) -> Array2<f32>[src]

Draws a sample from the represented MNIW distribution

pub fn sample_as_vec(&self, rng: &mut ThreadRng) -> Array1<f32>[src]

The same as Self::sample, but the result is flattened.

pub fn get_mean_as_vec(&self) -> ArrayView1<'_, f32>[src]

Returns the mean of the represented MNIW distribution, but flattened to be a vector.

pub fn get_mean(&self) -> Array2<f32>[src]

Returns the mean of the represented MNIW distribution as a linear map.

pub fn get_schmear(&self) -> FuncSchmear[src]

Gets the FuncSchmear over linear mappings given by this MNIW distribution

pub fn get_inverse_schmear(&self) -> FuncInverseSchmear[src]

Gets the FuncInverseSchmear over linear mappings given by this MNIW distribution.

pub fn get_precision(&self) -> FuncScatterTensor[src]

Gets the precision (inverse covariance) FuncScatterTensor of this MNIW distribution.

pub fn get_covariance(&self) -> FuncScatterTensor[src]

Gets the covariance FuncScatterTensor of this MNIW distribution.

impl NormalInverseWishart[src]

pub fn from_in_out_dims(
    prior_specification: &dyn PriorSpecification,
    feat_dims: usize,
    out_dims: usize
) -> NormalInverseWishart
[src]

Constructs a NormalInverseWishart distribution from the given PriorSpecification, the given feature dimensions, and the given output dimensions.

pub fn from_space_info(
    prior_specification: &dyn PriorSpecification,
    func_space_info: &FunctionSpaceInfo<'_>
) -> NormalInverseWishart
[src]

Constructs a NormalInverseWishart distribution from the given PriorSpecification and the given FunctionSpaceInfo.

pub fn new(
    mean: Array2<f32>,
    precision: Array2<f32>,
    big_v: Array2<f32>,
    little_v: f32
) -> NormalInverseWishart
[src]

Constructs a NormalInverseWishart distribution with the given mean, input precision, total output error covariance, and (pseudo-)observation count.

impl NormalInverseWishart[src]

pub fn update_datapoints(&mut self, data_points: &DataPoints)[src]

Updates this NormalInverseWishart distribution to reflect new data-points for linear regression.

Trait Implementations

impl AddAssign<&'_ DataPoint> for NormalInverseWishart[src]

fn add_assign(&mut self, other: &DataPoint)[src]

Updates this NormalInverseWishart distribution to incorporate regression information from the given DataPoint.

impl AddAssign<&'_ InputToSchmearedOutput> for NormalInverseWishart[src]

fn add_assign(&mut self, update: &InputToSchmearedOutput)[src]

Updates this NormalInverseWishart distribution to incorporate regression information from the given InputToSchmearedOutput.

impl AddAssign<&'_ Multiple<InputToSchmearedOutput>> for NormalInverseWishart[src]

fn add_assign(&mut self, update: &Multiple<InputToSchmearedOutput>)[src]

Performs the += operation. Read more

impl AddAssign<&'_ Multiple<NormalInverseWishart>> for NormalInverseWishart[src]

fn add_assign(&mut self, other: &Multiple<NormalInverseWishart>)[src]

Performs the += operation. Read more

impl AddAssign<&'_ NormalInverseWishart> for NormalInverseWishart[src]

fn add_assign(&mut self, other: &NormalInverseWishart)[src]

Updates this NormalInverseWishart distribution to the MNIW-sum of it and the passed in NormalInverseWishart distribution.

impl<'a> AddAssign<&'_ NormalInverseWishart> for Model<'a>[src]

fn add_assign(&mut self, other: &NormalInverseWishart)[src]

Updates this Model to reflect new prior information from the given NormalInverseWishart, which is assumed to come from another Model with the same input and return spaces.

impl BitXorAssign<()> for NormalInverseWishart[src]

fn bitxor_assign(&mut self, _rhs: ())[src]

Inverts this NormalInverseWishart distribution in place with respect to the addition operation given by the MNIW sum. This always will satisfy let mut other = self.clone(); other ^= (); other += self; self == zero_normal_inverse_wishart(self.t, self.s)

impl Clone for NormalInverseWishart[src]

fn clone(&self) -> NormalInverseWishart[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl SubAssign<&'_ DataPoint> for NormalInverseWishart[src]

fn sub_assign(&mut self, other: &DataPoint)[src]

Updates this NormalInverseWishart distribution to remove regression information from the given DataPoint.

impl SubAssign<&'_ InputToSchmearedOutput> for NormalInverseWishart[src]

fn sub_assign(&mut self, update: &InputToSchmearedOutput)[src]

Updates this NormalInverseWishart distribution to remove regression information from the given InputToSchmearedOutput.

impl SubAssign<&'_ Multiple<InputToSchmearedOutput>> for NormalInverseWishart[src]

fn sub_assign(&mut self, update: &Multiple<InputToSchmearedOutput>)[src]

Performs the -= operation. Read more

impl SubAssign<&'_ Multiple<NormalInverseWishart>> for NormalInverseWishart[src]

fn sub_assign(&mut self, other: &Multiple<NormalInverseWishart>)[src]

Performs the -= operation. Read more

impl SubAssign<&'_ NormalInverseWishart> for NormalInverseWishart[src]

fn sub_assign(&mut self, other: &NormalInverseWishart)[src]

Updates this NormalInverseWishart distribution to the MNIW-sum of it and the additive inverse of the passed in NormalInverseWishart distribution.

impl<'a> SubAssign<&'_ NormalInverseWishart> for Model<'a>[src]

fn sub_assign(&mut self, other: &NormalInverseWishart)[src]

Undoes the action of the corresponding add_assign method.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.

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

pub fn vzip(self) -> V