pub struct VmpConfig {
pub states: HashMap<String, VariationalState>,
pub factors: Vec<VmpFactor>,
pub max_iterations: usize,
pub tolerance: f64,
pub divergence_tolerance: f64,
}Expand description
User-facing configuration describing a VMP problem.
Fields§
§states: HashMap<String, VariationalState>Per-variable variational state.
factors: Vec<VmpFactor>Factors (conjugate relationships).
max_iterations: usizeMaximum iterations.
tolerance: f64Convergence tolerance on both ELBO change and the max L∞ residual.
divergence_tolerance: f64Maximum allowed ELBO decrease before the engine bails out with a
ConvergenceFailure error (guards against numerical divergence).
Implementations§
Source§impl VmpConfig
impl VmpConfig
Sourcepub fn with_gaussian(
self,
name: &str,
prior_mean: f64,
precision: f64,
) -> Result<Self>
pub fn with_gaussian( self, name: &str, prior_mean: f64, precision: f64, ) -> Result<Self>
Register a Gaussian variable with a prior N(prior_mean, 1/precision).
Sourcepub fn with_categorical(self, name: &str, num_categories: usize) -> Result<Self>
pub fn with_categorical(self, name: &str, num_categories: usize) -> Result<Self>
Register a Categorical variable with a flat prior over k categories.
Sourcepub fn with_dirichlet(self, name: &str, concentration: Vec<f64>) -> Result<Self>
pub fn with_dirichlet(self, name: &str, concentration: Vec<f64>) -> Result<Self>
Register a Dirichlet variable with prior concentration α.
Sourcepub fn with_factor(self, factor: VmpFactor) -> Self
pub fn with_factor(self, factor: VmpFactor) -> Self
Append a VMP factor.
Sourcepub fn with_limits(self, max_iterations: usize, tolerance: f64) -> Self
pub fn with_limits(self, max_iterations: usize, tolerance: f64) -> Self
Override the max iterations / tolerance pair.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VmpConfig
impl RefUnwindSafe for VmpConfig
impl Send for VmpConfig
impl Sync for VmpConfig
impl Unpin for VmpConfig
impl UnsafeUnpin for VmpConfig
impl UnwindSafe for VmpConfig
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.