DeltaTopic.nn.base_components.DeltaTopicEncoder

class DeltaTopic.nn.base_components.DeltaTopicEncoder(*args: Any, **kwargs: Any)[source]

A two-headed encoder that maps the two inputs into a shared latent space through a stack of individual and shared fully-connected layers.

Parameters:
  • n_input_list – List of the dimension of two input tensors

  • n_output – The dimensionality of the output

  • mask – The mask to apply to the first layer (experimental)

  • mask_first – Transpose the mask if set to false (experimental)

  • n_hidden – The number of nodes per hidden layer

  • n_layers_individual – The number of fully-connected hidden layers for the individual encoder

  • n_layers_shared – The number of fully-connected hidden layers for the shared encoder

  • dropout_rate – Dropout rate to apply to each of the hidden layers

  • use_batch_norm – Whether to have BatchNorm layers or not

  • log_variational – Whether to apply log(1+x) transformation to the input

  • combine_method – the method to combine the two latent space, either “add” or “concatenate”

__init__(n_input_list: List[int], n_output: int, mask: torch.Tensor | None = None, mask_first: bool = True, n_hidden: int = 128, n_layers_individual: int = 1, n_layers_shared: int = 2, n_cat_list: Iterable[int] | None = None, dropout_rate: float = 0.1, use_batch_norm: bool = True, log_variational: bool = True, combine_method: str = 'add')[source]

Methods

__init__(n_input_list, n_output[, mask, ...])

forward(x, y, *cat_list)

Forward pass for DeltaTopicEncoder