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>
impl<'a> TermModel<'a>
Sourcepub fn get_type_id(&self) -> TypeId
pub fn get_type_id(&self) -> TypeId
Sourcepub fn get_total_dims(&self) -> usize
pub fn get_total_dims(&self) -> usize
Sourcepub fn sample_as_vec(&self, rng: &mut ThreadRng) -> Array1<f32>
pub fn sample_as_vec(&self, rng: &mut ThreadRng) -> Array1<f32>
See Model::sample_as_vec.
Sourcepub fn get_mean_as_vec(&self) -> ArrayView1<'_, f32>
pub fn get_mean_as_vec(&self) -> ArrayView1<'_, f32>
Sourcepub fn get_inverse_schmear(&self) -> FuncInverseSchmear
pub fn get_inverse_schmear(&self) -> FuncInverseSchmear
Sourcepub fn get_schmear(&self) -> FuncSchmear
pub fn get_schmear(&self) -> FuncSchmear
See Model::get_schmear.
Sourcepub fn get_schmeared_hole(&self) -> SchmearedHole
pub fn get_schmeared_hole(&self) -> SchmearedHole
Gets the SchmearedHole in the base space of the type for this TermModel.
Sourcepub fn has_some_data_other_than(
&self,
term_input_output: &TermInputOutput,
) -> bool
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.
Sourcepub fn update_data(
&mut self,
update_key: TermInputOutput,
data_update: Multiple<InputToSchmearedOutput>,
)
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.
Sourcepub fn downdate_data(&mut self, update_key: &TermInputOutput) -> usize
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.
Sourcepub fn update_prior(
&mut self,
update_key: TermApplication,
distr: Multiple<NormalInverseWishart>,
)
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.
Sourcepub fn downdate_prior(&mut self, key: &TermApplication) -> usize
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.
Sourcepub fn new(
type_id: TypeId,
prior_specification: &dyn PriorSpecification,
ctxt: &'a Context,
) -> TermModel<'a>
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.