Helper Module for Deep Learning.
Variational Auto-Encoder (VAE).
-
class
pynet.models.vae.vae.Decoder(latent_dim, conv_flts, dense_hidden_dims, output_channels, output_dim, noise_out_logvar=-3, noise_fixed=True, act_func=None, final_activation=False, dropout=0)[source]¶ The decoder part of a VAE.
-
__init__(latent_dim, conv_flts, dense_hidden_dims, output_channels, output_dim, noise_out_logvar=-3, noise_fixed=True, act_func=None, final_activation=False, dropout=0)[source]¶ Init class.
- Parameters
latent_dim: int
the latent size.
conv_flts: list of int
the size of convolutional filters, if None do not include convolutional layers.
dense_hidden_dims: list of int
the size of dense hidden dimensions, if None do not include dense hidden layers.
output_channels: int
the number of output channels.
output_dim: int or list of int
the size of output.
noise_out_logvar: float, default -3
the init output log var.
noise_fixed: bool, default True
estimate the the output log var.
act_func: callable, default None
the activation function.
final_activation: bool, default False
apply activation function to the final layer.
dropout: float, default 0
define the dropout rate.
-
-
class
pynet.models.vae.vae.Encoder(input_channels, input_dim, conv_flts, dense_hidden_dims, latent_dim, act_func=None, dropout=0, log_alpha=None)[source]¶ The encoder part of a VAE.
-
__init__(input_channels, input_dim, conv_flts, dense_hidden_dims, latent_dim, act_func=None, dropout=0, log_alpha=None)[source]¶ Init class.
- Parameters
input_channels: int
the number of input channels.
input_dim: int or list of int
the size of input.
conv_flts: list of int
the size of convolutional filters, if None do not include convolutional layers.
dense_hidden_dims: list of int
the size of dense hidden dimensions, if None do not include dense hidden layers.
latent_dim: int
the latent dimension.
act_func: callable, default None
the activation function.
dropout: float, default 0
define the dropout rate.
log_alpha: nn.Parameter, default None
inducing sparse latent representations.
-
static
compute_logvar(mu, log_alpha)[source]¶ Compute the log variance in case of sparsity contraints.
-
static
final_conv_dim(input_dim, kernels, paddings)[source]¶ Infer the size of eaxh sample after the convolutions bloc.
-
-
class
pynet.models.vae.vae.VAENet(input_channels, input_dim, conv_flts, dense_hidden_dims, latent_dim, noise_out_logvar=-3, noise_fixed=True, log_alpha=None, act_func=None, final_activation=False, dropout=0, sparse=False, encoder=None, decoder=None)[source]¶ The VAE architecture.
Spatiotemporal Trajectories in Resting-state FMRI Revealed by Convolutional Variational Autoencoder, Xiaodi Zhang, Eric Maltbie, Shella Keilholz, bioRxiv 2021.
Deep Variational Autoencoder for Modeleing functional brain networks and ADHD idetification, ISBI 2020.
Sparse Multi-Channel Variational Autoencoder for the Joint Analysis of Heterogeneous Data, Luigi Antelmi, Nicholas Ayache, Philippe Robert, Marco Lorenzi, PMLR 2019.
-
__init__(input_channels, input_dim, conv_flts, dense_hidden_dims, latent_dim, noise_out_logvar=-3, noise_fixed=True, log_alpha=None, act_func=None, final_activation=False, dropout=0, sparse=False, encoder=None, decoder=None)[source]¶ Init class.
- Parameters
input_channels: int
the number of input channels.
input_dim: int or list of int
the size of input.
conv_flts: list of int
the size of convolutional filters, if None do not include convolutional layers.
dense_hidden_dims: list of int
the size of dense hidden dimensions, if None do not include dense hidden layers.
latent_dim: int
the latent dimension.
noise_out_logvar: float, default -3
the init output log var.
noise_fixed: bool, default True
estimate the the output log var.
log_alpha: nn.Parameter, default None
dropout probabilities estimate.
act_func: callable, default None
the activation function.
final_activation: bool, default False
apply activation function to the final layer.
dropout: float, default 0
define the dropout rate.
sparse: bool, default False
use sparsity contraint.
encoder: nn.Module, default None
a custom encoder.
decoder: nn.Module, default None
a custom decoder.
-
apply_threshold(z, threshold, keep_dims=True, reorder=False)[source]¶ Threshold the latent samples based on the estimated dropout probabilities.
-
property
dropout¶ Compute the dropout probabilities.
-
Follow us
Inspired by AZMIND template.