pub struct VariationalMessagePassing { /* private fields */ }Expand description
The VMP coordinate-ascent engine.
The engine itself is a thin state machine that holds the VmpConfig and
drives the per-variable update rules defined by each VmpFactor variant.
Implementations§
Source§impl VariationalMessagePassing
impl VariationalMessagePassing
Sourcepub fn with_graph(graph: &FactorGraph, config: VmpConfig) -> Result<Self>
pub fn with_graph(graph: &FactorGraph, config: VmpConfig) -> Result<Self>
Construct an engine from an already-existing FactorGraph (structure
only) plus the VMP annotations. The graph is consulted to validate that
every factor references variables that the user also registered with
the factor-graph API, which is useful when VMP is layered on top of the
generic PGM pipeline.
Sourcepub fn compute_elbo(&self) -> Result<f64>
pub fn compute_elbo(&self) -> Result<f64>
Evidence Lower Bound L(q) = E_q[log p(x, z)] − E_q[log q(z)].
For the three conjugate relationships shipped in v0.2.0 the ELBO
decomposes as Σ E_q[log p(factor)] − Σ KL(q(v) || prior(v)) because
each prior cancels with the log p(z) term.
Sourcepub fn states(&self) -> &HashMap<String, VariationalState>
pub fn states(&self) -> &HashMap<String, VariationalState>
Read-only access to the current states.
Auto Trait Implementations§
impl Freeze for VariationalMessagePassing
impl RefUnwindSafe for VariationalMessagePassing
impl Send for VariationalMessagePassing
impl Sync for VariationalMessagePassing
impl Unpin for VariationalMessagePassing
impl UnsafeUnpin for VariationalMessagePassing
impl UnwindSafe for VariationalMessagePassing
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.