easypheno.model.cnn

Module Contents

Classes

Cnn

Implementation of a class for a Convolutional Neural Network (CNN).

class easypheno.model.cnn.Cnn(task, optuna_trial, encoding=None, n_outputs=1, n_features=None, width_onehot=None, batch_size=None, n_epochs=None, early_stopping_point=None)

Bases: easypheno.model._torch_model.TorchModel

Implementation of a class for a Convolutional Neural Network (CNN).

See BaseModel and TorchModel for more information on the attributes.

Parameters
  • task (str) –

  • optuna_trial (optuna.trial.Trial) –

  • encoding (str) –

  • n_outputs (int) –

  • n_features (int) –

  • width_onehot (int) –

  • batch_size (int) –

  • n_epochs (int) –

  • early_stopping_point (int) –

standard_encoding = onehot
possible_encodings = ['onehot']
define_model(self)

Definition of a CNN network.

Architecture:

  • N_LAYERS of (Conv1d + BatchNorm + Dropout)

  • MaxPool1d, Flatten, Linear, BatchNorm, Dropout

  • Linear output layer

Kernel sizes for convolutional and max pooling layers may be fixed or optimized. Same applies for strides, number of output channels of the first convolutional layer, dropout rate, frequency of a doubling of the output channels and number of units in the first linear layer.

Return type

torch.nn.Sequential

define_hyperparams_to_tune(self)

See BaseModel for more information on the format.

See TorchModel for more information on hyperparameters common for all torch models.

Return type

dict