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 ContextImplementations§
Source§impl<'a> Model<'a>
impl<'a> Model<'a>
Sourcepub fn get_total_dims(&self) -> usize
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>
impl<'a> Model<'a>
Sourcepub fn get_context(&self) -> &'a Context
pub fn get_context(&self) -> &'a Context
Sourcepub fn sample(&self, rng: &mut ThreadRng) -> Array2<f32>
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.
Sourcepub fn sample_as_vec(&self, rng: &mut ThreadRng) -> Array1<f32>
pub fn sample_as_vec(&self, rng: &mut ThreadRng) -> Array1<f32>
Identical to Self::sample, but the result is flattened.
Sourcepub fn get_mean_as_vec(&self) -> ArrayView1<'_, f32>
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.
Sourcepub fn get_inverse_schmear(&self) -> FuncInverseSchmear
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.
Sourcepub fn get_schmear(&self) -> FuncSchmear
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>
impl<'a> Model<'a>
Sourcepub fn new(
prior_spec: &dyn PriorSpecification,
arg_type_id: TypeId,
ret_type_id: TypeId,
ctxt: &'a Context,
) -> Model<'a>
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>
impl<'a> AddAssign<&NormalInverseWishart> for Model<'a>
Source§fn add_assign(&mut self, other: &NormalInverseWishart)
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<DataPoints> for Model<'a>
impl<'a> AddAssign<DataPoints> for Model<'a>
Source§fn add_assign(&mut self, other: DataPoints)
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> SubAssign<&NormalInverseWishart> for Model<'a>
impl<'a> SubAssign<&NormalInverseWishart> for Model<'a>
Source§fn sub_assign(&mut self, other: &NormalInverseWishart)
fn sub_assign(&mut self, other: &NormalInverseWishart)
Undoes the action of the corresponding add_assign method.