1D Models
k3im.cait_1d.CAiT_1DModel
An extention of Class Attention in Image Transformers (CAiT) reimplemented for 1D Data.
The model expects 1D data of shape (batch, seq_len, channels)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
`seq_len` |
number of steps |
required | |
`patch_size` |
number steps in a patch |
required | |
`num_classes` |
output classes for classification |
required | |
`dim` |
projection dim for patches, |
required | |
`dim_head` |
size of each attention head |
required | |
`mlp_dim` |
Projection Dim in transformer after each MultiHeadAttention layer |
required | |
`depth` |
number of patch transformer units |
required | |
`cls_depth` |
number of transformer units applied to class attention transformer |
required | |
`heads` |
number of attention heads |
required | |
`channels` |
number of features/channels in the input default |
required | |
`dropout_rate` |
dropout applied to MultiHeadAttention in class and patch transformers |
required |
Source code in k3im/cait_1d.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
|
options: show_signature: true
k3im.cct_1d.CCT_1DModel
Create a Convolutional Transformer for sequences.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_shape |
A tuple of (seq_len, num_channels). |
required | |
num_heads |
An integer. |
required | |
projection_dim |
An integer representing the projection dimension. |
required | |
kernel_size |
An integer representing the size of the convolution window. |
required | |
stride |
An integer representing the stride of the convolution. |
required | |
padding |
One of 'valid', 'same' or 'causal'. Causal is for decoding. |
required | |
transformer_units |
A list of integers representing the number of units in each transformer layer. |
required | |
stochastic_depth_rate |
A float representing the drop probability for the stochastic depth layer. |
required | |
transformer_layers |
An integer representing the number of transformer layers. |
required | |
num_classes |
An integer representing the number of classes for classification. |
required | |
positional_emb |
Boolean, whether to use positional embeddings. |
False
|
Source code in k3im/cct_1d.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
|
k3im.convmixer_1d.ConvMixer1DModel
ConvMixer model for 1D data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
`seq_len` |
number of steps |
required | |
`n_features` |
number of features/channels in the input default |
required | |
`filters` |
number of filters in the convolutional stem |
required | |
`depth` |
number of conv mixer blocks |
required | |
`kernel_size` |
kernel size for the depthwise convolution |
required | |
`patch_size` |
number steps in a patch |
required | |
`num_classes` |
output classes for classification |
required |
Source code in k3im/convmixer_1d.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
k3im.eanet_1d.EANet1DModel
Create an External Attention Network for 1D data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
`seq_len` |
number of steps |
required | |
`patch_size` |
number steps in a patch |
required | |
`num_classes` |
output classes for classification |
required | |
`dim` |
projection dim for patches, |
required | |
`depth` |
number of patch transformer units |
required | |
`heads` |
number of attention heads |
required | |
`mlp_dim` |
Projection Dim in transformer after each MultiHeadAttention layer |
required | |
`dim_coefficient` |
coefficient for increasing the number of heads |
required | |
`attention_dropout` |
dropout applied to MultiHeadAttention in class and patch transformers |
required | |
`channels` |
number of features/channels in the input default |
required |
Source code in k3im/eanet_1d.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
|
k3im.fnet_1d.FNet1DModel
Instantiate a FNet model for 1D data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
seq_len |
An integer representing the number of steps in the input sequence. |
required | |
patch_size |
An integer representing the number of steps in a patch (default=4). |
required | |
num_classes |
An integer representing the number of classes for classification. |
required | |
dim |
An integer representing the projection dimension. |
required | |
depth |
An integer representing the number of transformer layers. |
required | |
channels |
An integer representing the number of channels in the input. |
3
|
|
dropout_rate |
A float representing the dropout rate. |
0.0
|
Source code in k3im/fnet_1d.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
k3im.gmlp_1d.gMLP1DModel
Instantiate a gMLP model for 1D data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
seq_len |
An integer representing the number of steps in the input sequence. |
required | |
patch_size |
An integer representing the number of steps in a patch (default=4). |
required | |
num_classes |
An integer representing the number of classes for classification. |
required | |
dim |
An integer representing the projection dimension. |
required | |
depth |
An integer representing the number of transformer layers. |
required | |
channels |
An integer representing the number of channels in the input. |
3
|
|
dropout_rate |
A float representing the dropout rate. |
0.0
|
Source code in k3im/gmlp_1d.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
|
k3im.mlp_mixer_1d.Mixer1DModel
Instantiate a Mixer model for 1D data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
seq_len |
An integer representing the number of steps in the input sequence. |
required | |
patch_size |
An integer representing the number of steps in a patch (default=4). |
required | |
num_classes |
An integer representing the number of classes for classification. |
required | |
dim |
An integer representing the projection dimension. |
required | |
depth |
An integer representing the number of transformer layers. |
required | |
channels |
An integer representing the number of channels in the input. |
3
|
|
hidden_units |
An integer representing the number of hidden units in the MLP. |
64
|
|
dropout_rate |
A float representing the dropout rate. |
0.0
|
Source code in k3im/mlp_mixer_1d.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
k3im.simple_vit_1d.SimpleViT1DModel
Create a Simple Vision Transformer for 1D data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
`seq_len` |
number of steps |
required | |
`patch_size` |
number steps in a patch |
required | |
`num_classes` |
output classes for classification |
required | |
`dim` |
projection dim for patches, |
required | |
`depth` |
number of patch transformer units |
required | |
`heads` |
number of attention heads |
required | |
`mlp_dim` |
Projection Dim in transformer after each MultiHeadAttention layer |
required | |
`channels` |
number of features/channels in the input default |
required | |
`dim_head` |
size of each attention head |
required |
Source code in k3im/simple_vit_1d.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
|
k3im.vit_1d.ViT1DModel
Create a Vision Transformer for 1D data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
`seq_len` |
number of steps |
required | |
`patch_size` |
number steps in a patch |
required | |
`num_classes` |
output classes for classification |
required | |
`dim` |
projection dim for patches, |
required | |
`depth` |
number of patch transformer units |
required | |
`heads` |
number of attention heads |
required | |
`mlp_dim` |
Projection Dim in transformer after each MultiHeadAttention layer |
required | |
`channels` |
number of features/channels in the input default |
required | |
`dim_head` |
size of each attention head |
required |
Source code in k3im/vit_1d.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|