TermModel

Struct TermModel 

Source
pub struct TermModel<'a> {
    pub type_id: TypeId,
    pub model: Model<'a>,
    /* private fields */
}
Expand description

A Model for a term, with information about what prior updates and data updates have been applied as part of the operation of the Bayesian embedding process in an crate::embedder_state::EmbedderState.

Fields§

§type_id: TypeId§model: Model<'a>

Implementations§

Source§

impl<'a> TermModel<'a>

Source

pub fn get_type_id(&self) -> TypeId

Gets the TypeId of the term that this TermModel is responsible for learning regression information about.

Source

pub fn get_total_dims(&self) -> usize

Source

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

Source

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

Source

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

Source

pub fn get_inverse_schmear(&self) -> FuncInverseSchmear

Source

pub fn get_schmear(&self) -> FuncSchmear

Source

pub fn get_schmeared_hole(&self) -> SchmearedHole

Gets the SchmearedHole in the base space of the type for this TermModel.

Source

pub fn has_some_data_other_than( &self, term_input_output: &TermInputOutput, ) -> bool

Returns true iff this TermModel has had at least one TermInputOutput applied which is not the given one.

Source

pub fn update_data( &mut self, update_key: TermInputOutput, data_update: Multiple<InputToSchmearedOutput>, )

Updates this TermModel with a data update stemming from the given TermInputOutput with data given by possibly multiple copies of the same InputToSchmearedOutput.

Source

pub fn downdate_data(&mut self, update_key: &TermInputOutput) -> usize

Downdates this TermModel for data updates with the given TermInputOutput key. Yields the number of data-points which were removed as a consequence of this operation.

Source

pub fn update_prior( &mut self, update_key: TermApplication, distr: Multiple<NormalInverseWishart>, )

Updates this TermModel with a prior update stemming from the given TermApplication with data given by possibly multiple copies of the same NormalInverseWishart distribution.

Source

pub fn downdate_prior(&mut self, key: &TermApplication) -> usize

Downdates this TermModel for prior updates with the given TermApplication key. Yields the number of prior applications which were removed as a consequence of this operation.

Source

pub fn new( type_id: TypeId, prior_specification: &dyn PriorSpecification, ctxt: &'a Context, ) -> TermModel<'a>

Constructs a new TermModel for the given type with the given PriorSpecification within the given Context.

Trait Implementations§

Source§

impl<'a> Clone for TermModel<'a>

Source§

fn clone(&self) -> TermModel<'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

Auto Trait Implementations§

§

impl<'a> Freeze for TermModel<'a>

§

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

§

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

§

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

§

impl<'a> Unpin for TermModel<'a>

§

impl<'a> !UnwindSafe for TermModel<'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