pub struct ConditionalPriorIvae {
pub mean: Array2<f64>,
pub scale: Array2<f64>,
pub weight: f64,
}Expand description
iVAE-style auxiliary-conditional Gaussian log-prior on the latent block.
Stores per-row conditional means μ of shape (n_rows, latent_dim) and
scales σ of shape (n_rows, latent_dim), where (μ_{n,i}, σ_{n,i}) are
presumed evaluated by some external Smooth at the auxiliary u_n. The
negative log-prior contribution to the latent objective is
½ Σ_n Σ_i [ ((t_{n,i} − μ_{n,i}) / σ_{n,i})² + 2 log σ_{n,i} + log 2π ]
scaled by weight. The gradient w.r.t. t is (t − μ) / σ² (times
weight); the gradient w.r.t. μ is its negative. Per-row scales make
this strictly more general than a fixed N(0, I), which is recovered by
μ ≡ 0, σ ≡ 1.
Fields§
§mean: Array2<f64>§scale: Array2<f64>§weight: f64Implementations§
Source§impl ConditionalPriorIvae
impl ConditionalPriorIvae
pub fn new( mean: Array2<f64>, scale: Array2<f64>, weight: f64, ) -> Result<Self, String>
Sourcepub fn value_and_grad(&self, t: ArrayView2<'_, f64>) -> (f64, Array2<f64>)
pub fn value_and_grad(&self, t: ArrayView2<'_, f64>) -> (f64, Array2<f64>)
Evaluate negative-log-prior value and gradient w.r.t. latent t.
Sourcepub fn value(&self, t: ArrayView2<'_, f64>) -> f64
pub fn value(&self, t: ArrayView2<'_, f64>) -> f64
Evaluate value only — useful when only the loss is needed.
Trait Implementations§
Source§impl Clone for ConditionalPriorIvae
impl Clone for ConditionalPriorIvae
Source§fn clone(&self) -> ConditionalPriorIvae
fn clone(&self) -> ConditionalPriorIvae
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ConditionalPriorIvae
impl RefUnwindSafe for ConditionalPriorIvae
impl Send for ConditionalPriorIvae
impl Sync for ConditionalPriorIvae
impl Unpin for ConditionalPriorIvae
impl UnsafeUnpin for ConditionalPriorIvae
impl UnwindSafe for ConditionalPriorIvae
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
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
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
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.