genome.models.dnn

Deep Neural Network models

class genome.models.dnn.HiddenLayer(input, n_in, n_out, layer_num, W=None, bias=None, activation=None)

Bases: object

Hidden Layer class object

This abstract class is used for a wrapper for intermediate layers. Common activation function used are T.nnet.sigmoid, T.nnet.softplus, T.nnet.relu, T.tanh.

Parameters:
  • input – A symbolic Tensor input
  • n_in (int) – Number of input variables.
  • n_out (int) – Number of output variables.
  • layer_num (int) – The n-th layer of the neural network
  • W – Weight parameters - A TensorSharedVariable (optional)
  • bias – Bias parameters - A TensorSharedVariable (optional)
  • activation – Activation function, example T.nnet.softplus, defaults to linear regression if undefined
class genome.models.dnn.MLP(input, n_in, n_out, layers)

Bases: genome.models.base.MultiLayerModel

Initializes a Multilayer perceptron model

Parameters:
  • input (theano.tensor.TensorVariable) – symbolic variable that describes the input
  • n_in (int) – Number of input variables
  • n_out (int) – Number of output variables
  • layers (list of theano.shared.TensorSharedVariable) – Defines the number of input connection, output connection and layer activation function. Example: [(n_in, n_hidden, activation),... (n_hidden, n_out, activation)]

Example

>>> x = T.matrix('x')
>>> model = MLP(input=x, n_in=5, n_out=2, layers=[(5, 4), (4, 2)])
errors(y)

see: errors()

negative_log_likelihood(y)

see: negative_log_likelihood()

class genome.models.dnn.ResLogit(input, n_vars, n_choices, n_layers, beta=None, asc=None)

Bases: genome.models.logit.MultinomialLogit

Initializes a ResLogit model

The ResLogit model consists of a series of residual blocks that captures the heterogeneity in the data. It is an extension of the MultinomialLogit class.

Parameters:
  • input (theano.tensor.TensorVariable) – symbolic variable that describes the input
  • n_vars (int) – Number of input variables
  • n_choices (int) – Number of choice alternatives
  • n_layers (int) – Number of residual layers
  • beta (theano.shared.TensorSharedVariable, optional) – \(\beta\) parameters
  • asc (theano.shared.TensorSharedVariable, optional) – Alternative Specific Constants
class genome.models.dnn.ResNetLayer(input, size, layer_num, W=None)

Bases: object

A ResNetLayer implementing a softplus activation and square matrix

For now, we don’t use reference parameters (masking) for the residual matrix. Reason – no logical reason to do so.

Parameters:
  • input – A symbolic Tensor input
  • size (tuple(int, int)) – The shape of the residual correlation matrix
  • layer_num (int) – The n-th layer of the neural network
  • W – Weight parameters - A TensorSharedVariable (optional)