ts-classification
Time SeriesTime-Series-Library
Description
Time Series Classification: Custom Model Design
Objective
Design and implement a custom deep learning model for multivariate time series classification. Your code goes in the Model class in models/Custom.py. Three reference implementations (DLinear, TimesNet, PatchTST) are provided as read-only.
Evaluation
Trained and evaluated on three UEA datasets:
- EthanolConcentration — spectral data classification
- FaceDetection — MEG brain imaging classification
- Handwriting — accelerometer-based character recognition
Training uses RAdam optimizer, CrossEntropyLoss, patience=10. Metric: accuracy (higher is better).
Code
Custom.py
EditableRead-only
1import torch2import torch.nn as nn3import torch.nn.functional as F456class Model(nn.Module):7"""8Custom model for time series classification.910Forward signature: forward(x_enc, x_mark_enc, x_dec, x_mark_dec, mask=None)11- x_enc: [batch, seq_len, enc_in] — input time series12- x_mark_enc: [batch, seq_len] — padding mask (1=valid, 0=padding)13- x_dec: not used (None)14- x_mark_dec: not used (None)15
Additional context files (read-only):
Time-Series-Library/models/DLinear.pyTime-Series-Library/models/TimesNet.pyTime-Series-Library/models/PatchTST.pyTime-Series-Library/layers/AutoCorrelation.pyTime-Series-Library/layers/Autoformer_EncDec.pyTime-Series-Library/layers/Conv_Blocks.pyTime-Series-Library/layers/Crossformer_EncDec.pyTime-Series-Library/layers/Embed.pyTime-Series-Library/layers/FourierCorrelation.pyTime-Series-Library/layers/SelfAttention_Family.pyTime-Series-Library/layers/StandardNorm.pyTime-Series-Library/layers/Transformer_EncDec.py
Results
| Model | Type | accuracy EthanolConcentration ↑ | accuracy FaceDetection ↑ | accuracy Handwriting ↑ |
|---|---|---|---|---|
| dlinear | baseline | 0.289 | 0.682 | 0.231 |
| patchtst | baseline | 0.285 | 0.685 | 0.254 |
| timesnet | baseline | 0.304 | 0.667 | 0.333 |
| timesnet | baseline | 0.319 | 0.675 | 0.335 |
| timesnet | baseline | 0.304 | 0.669 | 0.320 |
| timesnet | baseline | 0.304 | 0.669 | 0.346 |
| anthropic/claude-opus-4.6 | vanilla | 0.313 | 0.631 | 0.519 |
| deepseek-reasoner | vanilla | 0.288 | 0.562 | 0.258 |
| google/gemini-3.1-pro-preview | vanilla | 0.267 | 0.649 | 0.267 |
| openai/gpt-5.4-pro | vanilla | 0.284 | 0.638 | 0.511 |
| anthropic/claude-opus-4.6 | agent | 0.288 | 0.589 | 0.555 |
| deepseek-reasoner | agent | 0.283 | 0.597 | 0.469 |
| google/gemini-3.1-pro-preview | agent | 0.271 | 0.658 | 0.262 |
| openai/gpt-5.4-pro | agent | 0.286 | 0.651 | 0.462 |