TCNNetwork

class TCNNetwork(n_blocks: list = [16, 16, 16], kernel_size: int = 2, dropout: float = 0.2)[source]

Bases: BaseDeepLearningNetwork

Temporal Convolutional Network (TCN) for sequence modeling.

A generic convolutional architecture for sequence modeling that combines: - Dilated convolutions for exponentially large receptive fields - Residual connections for training stability

The TCN can take sequences of any length and map them to output sequences of the same length, making it suitable for autoregressive prediction tasks.

Parameters:
n_blockslist of int

List specifying the number of output channels for each layer. The length determines the depth of the network.

kernel_sizeint, default=2

Size of the convolutional kernel. Larger kernels can capture more local context but require more parameters.

dropoutfloat, default=0.2

Dropout rate applied after each convolutional layer for regularization.

Notes

The receptive field size grows exponentially with network depth due to dilated convolutions with dilation factors of 2^i for layer i.

References

[1]

Bai, S., Kolter, J. Z., & Koltun, V. (2018). An empirical evaluation of

generic convolutional and recurrent networks for sequence modeling. arXiv preprint arXiv:1803.01271.

Examples

>>> from aeon.networks._tcn import TCNNetwork
>>> network = TCNNetwork(n_blocks=[8, 8])
>>> input_layer, output = network.build_network(input_shape=(150, 4))
>>> input_layer.shape, output.shape
((None, 150, 4), (None, 4))

Methods

build_network(input_shape, **kwargs)

Build the complete TCN architecture.

build_network(input_shape: tuple, **kwargs) tuple[source]

Build the complete TCN architecture.

Constructs a series of temporal blocks with exponentially increasing dilation factors to achieve a large receptive field efficiently.

Parameters:
input_shapetuple

Shape of input data (n_timepoints, n_channels).

**kwargs

Additional keyword arguments (unused).

Returns:
tuple

A tuple containing (input_layer, output_tensor) representing the complete network architecture.

Notes

The dilation factor for layer i is 2^i, which ensures exponential growth of the receptive field while maintaining computational efficiency.