BetaTCVAE

This module is the implementation of the BetaTCVAE proposed in (https://arxiv.org/abs/1802.04942).

Available samplers

NormalSampler

Samples from a Standard normal distribution in the Autoencoder’s latent space.

GaussianMixtureSampler

Fits a Gaussian Mixture in the Autoencoder’s latent space.

TwoStageVAESampler

Fits a second VAE in the Autoencoder’s latent space.

MAFSampler

Fits a Masked Autoregressive Flow in the Autoencoder’s latent space.

IAFSampler

Fits an Inverse Autoregressive Flow in the Autoencoder’s latent space.

class pythae.models.BetaTCVAEConfig(input_dim=None, latent_dim=10, uses_default_encoder=True, uses_default_decoder=True, reconstruction_loss='mse', alpha=1.0, beta=1.0, gamma=1.0, use_mss=True)[source]

\(\beta\)-TCVAE model config config class

Parameters
  • input_dim (tuple) – The input_data dimension.

  • latent_dim (int) – The latent space dimension. Default: None.

  • reconstruction_loss (str) – The reconstruction loss to use [‘bce’, ‘mse’]. Default: ‘mse’

  • alpha (float) – The balancing factor before the Index code Mutual Info. Default: 1

  • beta (float) – The balancing factor before the Total Correlation. Default: 1

  • gamma (float) – The balancing factor before the dimension-wise KL. Default: 1

  • use_mss (bool) – Use Minibatch Stratified Sampling. If False: uses Minibatch Weighted Sampling. Default: True

class pythae.models.BetaTCVAE(model_config, encoder=None, decoder=None)[source]

\(\beta\)-TCVAE model.

Parameters
  • model_config (BetaTCVAEConfig) – The Variational Autoencoder configuration setting the main parameters of the model.

  • encoder (BaseEncoder) – An instance of BaseEncoder (inheriting from torch.nn.Module which plays the role of encoder. This argument allows you to use your own neural networks architectures if desired. If None is provided, a simple Multi Layer Preception (https://en.wikipedia.org/wiki/Multilayer_perceptron) is used. Default: None.

  • decoder (BaseDecoder) – An instance of BaseDecoder (inheriting from torch.nn.Module which plays the role of decoder. This argument allows you to use your own neural networks architectures if desired. If None is provided, a simple Multi Layer Preception (https://en.wikipedia.org/wiki/Multilayer_perceptron) is used. Default: None.

Note

For high dimensional data we advice you to provide you own network architectures. With the provided MLP you may end up with a MemoryError.

forward(inputs, **kwargs)[source]

The VAE model

Parameters

inputs (BaseDataset) – The training dataset with labels

Returns

An instance of ModelOutput containing all the relevant parameters

Return type

ModelOutput