crested.tl.zoo.deeptopic_cnn

Contents

crested.tl.zoo.deeptopic_cnn#

crested.tl.zoo.deeptopic_cnn(seq_len, num_classes, filters=1024, first_kernel_size=17, pool_size=4, dense_out=1024, first_activation='gelu', activation='relu', output_activation='sigmoid', conv_do=0.15, normalization='batch', dense_do=0.5, pre_dense_do=0.5, first_kernel_l2=0.0001, kernel_l2=1e-05)#

Construct a DeepTopicCNN model. Usually used for topic classification.

Parameters:
  • seq_len (int) – Width of the input region.

  • num_classes (int) – Number of classes to predict.

  • filters (int (default: 1024)) – Number of filters in the first convolutional layer. Followed by halving in subsequent layers.

  • first_kernel_size (int (default: 17)) – Size of the kernel in the first convolutional layer.

  • pool_size (int (default: 4)) – Size of the pooling kernel.

  • dense_out (int (default: 1024)) – Number of neurons in the dense layer.

  • first_activation (str (default: 'gelu')) – Activation function for the first conv block.

  • activation (str (default: 'relu')) – Activation function for subsequent blocks.

  • output_activation (str (default: 'sigmoid')) – Activation function for the output layer.

  • conv_do (float (default: 0.15)) – Dropout rate for the convolutional layers.

  • normalization (str (default: 'batch')) – Type of normalization (‘batch’ or ‘layer’).

  • dense_do (float (default: 0.5)) – Dropout rate for the dense layers.

  • pre_dense_do (float (default: 0.5)) – Dropout rate right before the dense layers.

  • first_kernel_l2 (float (default: 0.0001)) – L2 regularization for the first convolutional layer.

  • kernel_l2 (float (default: 1e-05)) – L2 regularization for the other convolutional layers.

Return type:

Model

Returns:

A Keras model.