pub struct NormalizingFlow<T: FloatBounds> { /* private fields */ }Expand description
Normalizing Flow model for density estimation
Implements a stack of coupling layers to learn complex distributions from a simple base distribution (typically Gaussian).
Implementations§
Source§impl<T: FloatBounds + ScalarOperand> NormalizingFlow<T>
impl<T: FloatBounds + ScalarOperand> NormalizingFlow<T>
Sourcepub fn new(config: NormalizingFlowConfig) -> Self
pub fn new(config: NormalizingFlowConfig) -> Self
Create a new normalizing flow model
Sourcepub fn forward(&mut self, x: &Array2<T>) -> NeuralResult<(Array2<T>, T)>
pub fn forward(&mut self, x: &Array2<T>) -> NeuralResult<(Array2<T>, T)>
Forward pass: data -> latent
Sourcepub fn inverse(&self, z: &Array2<T>) -> NeuralResult<Array2<T>>
pub fn inverse(&self, z: &Array2<T>) -> NeuralResult<Array2<T>>
Inverse pass: latent -> data
Sourcepub fn sample(&self, n_samples: usize) -> NeuralResult<Array2<T>>
pub fn sample(&self, n_samples: usize) -> NeuralResult<Array2<T>>
Sample from the model
Sourcepub fn log_likelihood(&mut self, x: &Array2<T>) -> NeuralResult<T>
pub fn log_likelihood(&mut self, x: &Array2<T>) -> NeuralResult<T>
Compute negative log likelihood
Sourcepub fn num_parameters(&self) -> usize
pub fn num_parameters(&self) -> usize
Get total number of parameters
Sourcepub fn config(&self) -> &NormalizingFlowConfig
pub fn config(&self) -> &NormalizingFlowConfig
Get configuration
Auto Trait Implementations§
impl<T> Freeze for NormalizingFlow<T>where
T: Freeze,
impl<T> RefUnwindSafe for NormalizingFlow<T>where
T: RefUnwindSafe,
impl<T> Send for NormalizingFlow<T>
impl<T> Sync for NormalizingFlow<T>
impl<T> Unpin for NormalizingFlow<T>where
T: Unpin,
impl<T> UnsafeUnpin for NormalizingFlow<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for NormalizingFlow<T>where
T: UnwindSafe + RefUnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 more