scimilarity.nn_models#
This file contains the neural network architectures. These are all you need for inference.
- class scimilarity.nn_models.Decoder(n_genes, latent_dim=128, hidden_dim=[1024, 1024], dropout=0.5)[source]#
Bases:
Module
A class that encapsulates the decoder.
- Parameters:
n_genes (int) – The number of genes in the gene space, representing the input dimensions.
latent_dim (int, default: 128) – The latent space dimensions
hidden_dim (List[int], default: [1024, 1024]) – A list of hidden layer dimensions, describing the number of layers and their dimensions. Hidden layers are constructed in the order of the list for the encoder and in reverse for the decoder.
dropout (float, default: 0.5) – The dropout rate for hidden layers
- forward(x)[source]#
Forward.
- Parameters:
x (torch.Tensor) – Input tensor corresponding to input layer.
- Returns:
Output tensor corresponding to output layer.
- Return type:
torch.Tensor
- class scimilarity.nn_models.Encoder(n_genes, latent_dim=128, hidden_dim=[1024, 1024], dropout=0.5, input_dropout=0.4)[source]#
Bases:
Module
A class that encapsulates the encoder.
- Parameters:
n_genes (int) – The number of genes in the gene space, representing the input dimensions.
latent_dim (int, default: 128) – The latent space dimensions
hidden_dim (List[int], default: [1024, 1024]) – A list of hidden layer dimensions, describing the number of layers and their dimensions. Hidden layers are constructed in the order of the list for the encoder and in reverse for the decoder.
dropout (float, default: 0.5) – The dropout rate for hidden layers
input_dropout (float, default: 0.4) – The dropout rate for the input layer
- forward(x)[source]#
Forward.
- Parameters:
x (torch.Tensor) – Input tensor corresponding to input layer.
- Returns:
Output tensor corresponding to output layer.
- Return type:
torch.Tensor