Skip to main content

ELBO

Struct ELBO 

Source
pub struct ELBO {
    pub kl_term: f64,
    pub reconstruction_term: f64,
}
Expand description

Evidence Lower Bound (ELBO) for variational inference.

ℒ(q) = E_q[log p(x,z)] - E_q[log q(z)] = log p(x) - D_KL(q(z) ‖ p(z|x))

Fields§

§kl_term: f64

D_KL(q‖p) component.

§reconstruction_term: f64

E_q[log p(x,z)] reconstruction term.

Implementations§

Source§

impl ELBO

Source

pub fn new(reconstruction_term: f64, kl_term: f64) -> Self

Create a new ELBO from its components.

Source

pub fn value(&self) -> f64

Compute ℒ(q) = reconstruction_term - kl_term.

Source

pub fn compute(q: &[f64], p_joint: &[f64]) -> f64

Compute ELBO from discrete distributions q(z) and joint p(x,z).

ℒ = Σ_z q(z) log(p(x,z)/q(z))

Auto Trait Implementations§

§

impl Freeze for ELBO

§

impl RefUnwindSafe for ELBO

§

impl Send for ELBO

§

impl Sync for ELBO

§

impl Unpin for ELBO

§

impl UnsafeUnpin for ELBO

§

impl UnwindSafe for ELBO

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.