Model

Struct Model 

Source
pub struct Model<'a> {
    pub arg_type_id: TypeId,
    pub ret_type_id: TypeId,
    pub data: NormalInverseWishart,
    pub ctxt: &'a Context,
}
Expand description

A representation of the information known via Bayesian regression of a nonlinear model from the compressed space of the given argument TypeId to the compressed space of the given return TypeId. The wrapped NormalInverseWishart linear model is defined on mappings from the feature space of the input to the compressed space of the output, and the whole Model is assumed to exist in the given Context.

Fields§

§arg_type_id: TypeId§ret_type_id: TypeId§data: NormalInverseWishart§ctxt: &'a Context

Implementations§

Source§

impl<'a> Model<'a>

Source

pub fn get_total_dims(&self) -> usize

Gets the total number of coefficients used to define the mean of this Model

Source§

impl<'a> Model<'a>

Source

pub fn get_context(&self) -> &'a Context

Gets the Context that this Model exists within.

Source

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

Draws a sample of a linear mapping from the feature space of the input to the compressed space of the output from the distribution defined by this Model.

Source

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

Identical to Self::sample, but the result is flattened.

Source

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

Gets the mean of the underlying NormalInverseWishart model from the feature space of the input space to the compressed space of the output, as a flattened vector.

Source

pub fn get_inverse_schmear(&self) -> FuncInverseSchmear

Gets the FuncInverseSchmear for the underlying NormalInverseWishart model from the feature space of the input to the compressed space of the output.

Source

pub fn get_schmear(&self) -> FuncSchmear

Gets the FuncSchmear for the underlying NormalInverseWishart model from the feature space of the input to the compressed space of the output.

Source§

impl<'a> Model<'a>

Source

pub fn new( prior_spec: &dyn PriorSpecification, arg_type_id: TypeId, ret_type_id: TypeId, ctxt: &'a Context, ) -> Model<'a>

Constructs a new Model with the given PriorSpecification for the underlying NormalInverseWishart model, the given argument and return types, and existing within the given Context.

Trait Implementations§

Source§

impl<'a> AddAssign<&NormalInverseWishart> for Model<'a>

Source§

fn add_assign(&mut self, other: &NormalInverseWishart)

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.

Source§

impl<'a> AddAssign<DataPoint> for Model<'a>

Source§

fn add_assign(&mut self, other: DataPoint)

Updates this Model to reflect new regression information from the given DataPoint, which is assumed to map from the compressed space of the input to the compressed space of the output.

Source§

impl<'a> AddAssign<DataPoints> for Model<'a>

Source§

fn add_assign(&mut self, other: DataPoints)

Updates this Model to reflect new regression information from the given DataPoints, which is assumed to map from the compressed space of the input to the compressed space of the output.

Source§

impl<'a> Clone for Model<'a>

Source§

fn clone(&self) -> Model<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> SubAssign<&NormalInverseWishart> for Model<'a>

Source§

fn sub_assign(&mut self, other: &NormalInverseWishart)

Undoes the action of the corresponding add_assign method.

Source§

impl<'a> SubAssign<DataPoint> for Model<'a>

Source§

fn sub_assign(&mut self, other: DataPoint)

Undoes the action of the corresponding add_assign method.

Auto Trait Implementations§

§

impl<'a> Freeze for Model<'a>

§

impl<'a> !RefUnwindSafe for Model<'a>

§

impl<'a> !Send for Model<'a>

§

impl<'a> !Sync for Model<'a>

§

impl<'a> Unpin for Model<'a>

§

impl<'a> !UnwindSafe for Model<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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