Skip to content

generator

NetworkGenerator

The base class for generating a network. It can be used to generate a CNN or Multi-Layer Perceptron.

Attributes
  • n_output_node: Number of output nodes in the network.

  • input_shape: A tuple to represent the input shape.

init

Initialize the instance. Sets the parameters n_output_node and input_shape for the instance.

Args
  • n_output_node: An integer. Number of output nodes in the network.

  • input_shape: A tuple. Input shape of the network.

CnnGenerator

A class to generate CNN.

Attributes
  • n_dim: len(self.input_shape) - 1

  • conv: A class that represents (n_dim-1) dimensional convolution.

  • dropout: A class that represents (n_dim-1) dimensional dropout.

  • global_avg_pooling: A class that represents (n_dim-1) dimensional Global Average Pooling.

  • pooling: A class that represents (n_dim-1) dimensional pooling.

  • batch_norm: A class that represents (n_dim-1) dimensional batch normalization.

init

Initialize the instance.

Args
  • n_output_node: An integer. Number of output nodes in the network.

  • input_shape: A tuple. Input shape of the network.

generate

Generates a CNN.

Args
  • model_len: An integer. Number of convolutional layers.

  • model_width: An integer. Number of filters for the convolutional layers.

Returns

MlpGenerator

A class to generate Multi-Layer Perceptron.

init

Initialize the instance.

Args
  • n_output_node: An integer. Number of output nodes in the network.

  • input_shape: A tuple. Input shape of the network. If it is 1D, ensure the value is appended by a comma in the tuple.

generate

Generates a Multi-Layer Perceptron.

Args
  • model_len: An integer. Number of hidden layers.

  • model_width: An integer or a list of integers of length model_len. If it is a list, it represents the number of nodes in each hidden layer. If it is an integer, all hidden layers have nodes equal to this value.

Returns