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_layerint

The number of neurons in the input layer.

n_units_hidden_layerslist

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.

activationslist

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_namestr, {"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_optionsdict

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.

forward(z)

Forward pass through the neural network.

Parameters:
ztorch.Tensor

A tensor holding the representations to pass through the decoder.

Returns:
ytorch.Tensor

A tensor holding the outputs of the decoder for the given representations.