Struct fetish_lib::elaborator::Elaborator [−][src]
pub struct Elaborator<'a> { pub type_id: TypeId, pub model: NormalInverseWishart, pub updates: HashMap<TermIndex, Vec<InputToSchmearedOutput>>, pub ctxt: &'a Context, }
Expand description
Learned left-inverse to the sketcher for a given type.
Given compressed vectors, an Elaborator
represents
information about likely-to-be-seen vectors
in the base space which project to it.
Fields
type_id: TypeId
model: NormalInverseWishart
Expand description
The linear model here is from projected vectors to vectors expressed in terms of the orthogonal basis for the kernel of the projection for the given type.
updates: HashMap<TermIndex, Vec<InputToSchmearedOutput>>
Expand description
Stored collection of InputToSchmearedOutput
updates that have been applied to this Elaborator
indexed by the TermIndex
es of terms that they originated from.
ctxt: &'a Context
Implementations
impl<'a> Elaborator<'a>
[src]
impl<'a> Elaborator<'a>
[src]pub fn new(
type_id: TypeId,
prior_specification: &dyn PriorSpecification,
ctxt: &'a Context
) -> Elaborator<'a>
[src]
pub fn new(
type_id: TypeId,
prior_specification: &dyn PriorSpecification,
ctxt: &'a Context
) -> Elaborator<'a>
[src]Constructs a new Elaborator
for the given TypeId
in the given Context
.
Before calling this, you should make sure that there is in fact a crate::linear_sketch::LinearSketch
for the given type, and that it has a kernel. There’s no point in creating one of these
otherwise.
pub fn get_mean(&self) -> Array2<f32>
[src]
pub fn get_mean(&self) -> Array2<f32>
[src]Gets the mean of the distribution that this Elaborator
defines over the left-inverse
of the projection for this elaborator’s type.
pub fn sample(&self, rng: &mut ThreadRng) -> Array2<f32>
[src]
pub fn sample(&self, rng: &mut ThreadRng) -> Array2<f32>
[src]Samples a left-inverse to the projection for this elaborator’s type from the
distribution defined by this Elaborator
.
pub fn expand_schmear(&self, compressed_schmear: &Schmear) -> Schmear
[src]
pub fn expand_schmear(&self, compressed_schmear: &Schmear) -> Schmear
[src]Using the distribution that this Elaborator
defines over possible
expansions of vectors, and given a Schmear
in the compressed space,
yields the Schmear
in the expanded space which corresponds to sampling
possible expansion matrices from the Elaborator
and vectors from the
passed in Schmear
, and applying the former to the latter.
pub fn get_expansion_func_schmear(&self) -> FuncSchmear
[src]
pub fn get_expansion_func_schmear(&self) -> FuncSchmear
[src]Gets the FuncSchmear
that this Elaborator
defines over left-inverses
to the projection matrix for the type of this elaborator.
pub fn has_data(&self, update_key: &TermIndex) -> bool
[src]
pub fn has_data(&self, update_key: &TermIndex) -> bool
[src]Returns true if this Elaborator
has an update stemming from the given
TermIndex
that has been applied to it.
pub fn update_data(&mut self, update_key: TermIndex, data_update: &Model<'_>)
[src]
pub fn update_data(&mut self, update_key: TermIndex, data_update: &Model<'_>)
[src]Given a Model
for a term with the given TermIndex
, updates this
Elaborator
to reflect that the passed Model
should be something
that this Elaborator
does a good job of faithfully representing through
a round-trip projection for the type -> expansion with the Elaborator
.
pub fn downdate_data(&mut self, update_key: &TermIndex)
[src]
pub fn downdate_data(&mut self, update_key: &TermIndex)
[src]Undoes an update added for the given TermIndex
using Self::update_data
Auto Trait Implementations
impl<'a> !RefUnwindSafe for Elaborator<'a>
impl<'a> !Send for Elaborator<'a>
impl<'a> !Sync for Elaborator<'a>
impl<'a> Unpin for Elaborator<'a>
impl<'a> !UnwindSafe for Elaborator<'a>
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,