CNNNetwork

class CNNNetwork(n_layers=2, kernel_size=7, n_filters=None, avg_pool_size=3, activation='sigmoid', padding='valid', strides=1, dilation_rate=1, use_bias=True)[source]

Establish the network structure for a CNN.

Adapted from the implementation used in [1].

Parameters:
n_layersint, default = 2

The number of convolution layers in the network.

kernel_sizeint or list of int, default = 7

Kernel size of convolution layers, if not a list, the same kernel size is used for all layer, len(list) should be n_layers.

n_filtersint or list of int, default = [6, 12]

Number of filters for each convolution layer, if not a list, the same n_filters is used in all layers.

avg_pool_sizeint or list of int, default = 3

The size of the average pooling layer, if not a list, the same max pooling size is used for all convolution layer.

activationstr or list of str, default = “sigmoid”

Keras activation function used in the model for each layer, if not a list, the same activation is used for all layers.

paddingstr or list of str, default = “valid”

The method of padding in convolution layers, if not a list, the same padding used for all convolution layers.

stridesint or list of int, default = 1

The strides of kernels in the convolution and max pooling layers, if not a list, the same strides are used for all layers.

dilation_rateint or list of int, default = 1

The dilation rate of the convolution layers, if not a list, the same dilation rate is used all over the network.

use_biasbool or list of bool, default = True

Condition on whether or not to use bias values for convolution layers, if not a list, the same condition is used for all layers.

Notes

Adapted from source code https://github.com/hfawaz/dl-4-tsc/blob/master/classifiers/cnn.py

References

[1]

Zhao et al. Convolutional neural networks for time series classification,

Journal of Systems Engineering and Electronics 28(1), 162–169, 2017

Methods

build_network(input_shape, **kwargs)

Construct a network and return its input and output layers.

build_network(input_shape, **kwargs)[source]

Construct a network and return its input and output layers.

Parameters:
input_shapetuple

The shape of the data fed into the input layer.

Returns:
input_layera keras layer
output_layera keras layer