core.decoder
This module contains the classes defining the decoder (core.decoder.Decoder).
- class core.decoder.Decoder(n_units_input_layer, n_units_hidden_layers, activations, output_module_name, output_module_options)
Class implementing the decoder.
- __init__(n_units_input_layer, n_units_hidden_layers, activations, output_module_name, output_module_options)
Initialize an instance of the neural network representing the decoder.
- Parameters:
- n_units_input_layer
int The number of neurons in the input layer.
- n_units_hidden_layers
list The number of units in each of the hidden layers. As many hidden layers as the number of items in the list will be created.
- activations
list A list containing the names of the activation functions to use in each hidden layer. Available activation functions are:
"relu": the ReLU function."elu": the ELU function.
- output_module_name
str, {"nb_feature_dispersion","nb_full_dispersion","poisson"} The name of the output module that will be set. Available output modules are:
"nb_feature_dispersion"for negative binomial distributions with means learned per gene per sample and r-values learned per gene."nb_full_dispersion"for negative binomial distributions with both means and r-values learned per gene per sample."poisson"for Poisson distributions with means learned per gene per sample.
- output_module_options
dict A dictionary of options for setting up the output module.
For the
"nb_feature_dispersion"output module, the following options must be provided:"activation": the name of the activation function to be used in the output module."r_init": the initial r-value for the negative binomial distributions modeling the genes’ counts.
For the
"nb_full_dispersion"output module, the following options must be provided:"activation": the name of the activation function to be used in the output module.
For the
"poisson"output module, the following options must be provided:"activation": the name of the activation function to be used in the output module.
- n_units_input_layer
- forward(z)
Forward pass through the neural network.
- Parameters:
- z
torch.Tensor A tensor holding the representations to pass through the decoder.
- z
- Returns:
- y
torch.Tensor A tensor holding the outputs of the decoder for the given representations.
- y