varencoder module

This module contains the whole implementation of Felon Finder’s variational autoencoder. This is truly part of the heart of Felon Finder.

class varencoder.Sampling(*args, **kwargs)[source]

Bases: Layer

Sampling layer for VAE.

This layer takes the mean and log variance of the latent space distribution as input and samples from the distribution to produce a latent vector.

call(inputs)[source]

Samples from the latent space distribution.

Parameters:

inputs (tuple) – Tuple containing mean and log variance of the latent space distribution.

Returns:

Sampled latent vector.

Return type:

tensor

class varencoder.VAE(*args, **kwargs)[source]

Bases: Model

Variational Autoencoder class.

call(x)[source]

Call method for VAE model.

Parameters:

x – Input data.

Returns:

Decoded output.

Return type:

tensor

get_config()[source]

Returns the configuration of the VAE model.

property metrics

Returns the list of metrics.

train_step(data)[source]

Performs a single training step.

Parameters:

data – Input data.

Returns:

Dictionary containing loss values.

Return type:

dict

varencoder.decoder_create(latent_dim=1024)[source]

Creates a decoder model.

Parameters:

latent_dim (int) – Dimensionality of the latent space.

Returns:

Decoder model.

Return type:

keras.Model

varencoder.encoder_create(latent_dim=1024)[source]

Creates an encoder model.

Parameters:

latent_dim (int) – Dimensionality of the latent space.

Returns:

Encoder model.

Return type:

keras.Model