TapNetNetwork¶
- class TapNetNetwork(dropout=0.5, filter_sizes=(256, 256, 128), kernel_size=(8, 5, 3), dilation=1, layers=(500, 300), use_rp=True, rp_params=(-1, 3), use_att=True, use_lstm=True, use_cnn=True, padding='same')[source]¶
Establish Network structure for TapNet.
Adapted from the implementation used in [1]
- Parameters:
- kernel_sizearray of int, default = (8, 5, 3)
Specifying the length of the 1D convolution window.
- layersarray of int, default = (500, 300)
Size of dense layers.
- filter_sizesarray of int, shape = (n_conv_layers), default = (256, 256, 128)
- rp_paramsarray of int, default = (-1, 3)
Parameters for random permutation.
- dropoutfloat, default = 0.5
Dropout rate, in the range [0, 1).
- dilationint, default = 1
Dilation value.
- paddingstr, default = ‘same’
Type of padding for convolution layers.
- use_rpbool, default = True
Whether to use random projections.
- use_attbool, default = True
Whether to use self attention.
- use_lstmbool, default = True
Whether to use an LSTM layer.
- use_cnnbool, default = True
Whether to use a CNN layer.
References
[1]Zhang et al. Tapnet: Multivariate time series classification with
attentional prototypical network, Proceedings of the AAAI Conference on Artificial Intelligence 34(4), 6845-6852, 2020
Methods
build_network(input_shape, **kwargs)Construct a network and return its input and output layers.
euclidean_dist(x, y)Get l2 distance between two points.
output_conv_size(in_size, kernel_size, ...)Get output size from a convolution layer.
- static output_conv_size(in_size, kernel_size, strides, padding)[source]¶
Get output size from a convolution layer.
- Parameters:
- in_sizeint
Dimension of input image, either height or width
- kernel_sizeint
Size of the convolutional kernel that is applied
- stridesint
Stride step between convolution operations
- paddingint
Amount of padding done on input.
- Returns:
- outputint
Corresponding output dimension after convolution