tsgm.models.monitors

Module Contents

class GANMonitor(num_samples: int, latent_dim: int, labels: tsgm.types.Tensor, save: bool = True, save_path: str | None = None, mode: str = 'clf')[source]

Bases: tensorflow.keras.callbacks.Callback

GANMonitor is a Keras callback for monitoring and visualizing generated samples during training.

Parameters:
  • num_samples (int) – The number of samples to generate and visualize.

  • latent_dim (int) – The dimensionality of the latent space. Defaults to 128.

  • output_dim (int) – The dimensionality of the output space. Defaults to 2.

  • save (bool) – Whether to save the generated samples. Defaults to True.

  • save_path (str) – The path to save the generated samples. Defaults to None.

Raises:

ValueError – If the mode is not one of [‘clf’, ‘reg’]

Note:

If save is True and save_path is not specified, the default save path is “/tmp/”.

Warning:

If save_path is specified but save is False, a warning is issued.

on_epoch_end(epoch: int, logs: Dict | None = None) None[source]

Callback function called at the end of each training epoch.

Parameters:
  • epoch (int) – Current epoch number.

  • logs (dict) – Dictionary containing the training loss values.

class VAEMonitor(num_samples: int = 6, latent_dim: int = 128, output_dim: int = 2, save: bool = True, save_path: str | None = None)[source]

Bases: tensorflow.keras.callbacks.Callback

VAEMonitor is a Keras callback for monitoring and visualizing generated samples from a Variational Autoencoder (VAE) during training.

Parameters:
  • num_samples (int) – The number of samples to generate and visualize. Defaults to 6.

  • latent_dim (int) – The dimensionality of the latent space. Defaults to 128.

  • output_dim (int) – The dimensionality of the output space. Defaults to 2.

  • save (bool) – Whether to save the generated samples. Defaults to True.

  • save_path (str) – The path to save the generated samples. Defaults to None.

Raises:

ValueError – If output_dim is less than or equal to 0.

Note:

If save is True and save_path is not specified, the default save path is “/tmp/”.

Warning:

If save_path is specified but save is False, a warning is issued.

on_epoch_end(epoch: int, logs: Dict | None = None) None[source]

Callback function called at the end of each training epoch.

Parameters:
  • epoch (int) – The current epoch number.

  • logs (dict) – Dictionary containing the training loss values.