ts-long-term-forecast
Time SeriesTime-Series-Library
Description
Long-Term Time Series Forecasting: Custom Model Design
Objective
Design and implement a custom deep learning model for multivariate long-term time series forecasting. Your code goes in the Model class in models/Custom.py. Three reference implementations (DLinear, PatchTST, iTransformer) are provided as read-only.
Evaluation
Trained and evaluated on three multivariate datasets:
- ETTh1 (7 variables, hourly electricity transformer temperature)
- Weather (21 variables, weather observations)
- ECL (321 variables, electricity consumption)
All use seq_len=96, pred_len=96. Metrics: MSE and MAE (lower is better).
Code
Custom.py
EditableRead-only
1import torch2import torch.nn as nn345class Model(nn.Module):6"""7Custom model for long-term time series forecasting.89Forward signature: forward(x_enc, x_mark_enc, x_dec, x_mark_dec, mask=None)10- x_enc: [batch, seq_len, enc_in] — input time series11- x_mark_enc: [batch, seq_len, time_features] — time feature encoding12- x_dec: [batch, label_len+pred_len, dec_in] — decoder input13- x_mark_dec: [batch, label_len+pred_len, time_features] — decoder time features14- mask: optional binary mask15
Additional context files (read-only):
Time-Series-Library/models/DLinear.pyTime-Series-Library/models/PatchTST.pyTime-Series-Library/models/iTransformer.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 | mse ETTh1 ↓ | mae ETTh1 ↓ | mse Weather ↓ | mae Weather ↓ | mse ECL ↓ | mae ECL ↓ |
|---|---|---|---|---|---|---|---|
| dlinear | baseline | 0.396 | 0.411 | 0.196 | 0.256 | 0.210 | 0.302 |
| itransformer | baseline | 0.395 | 0.410 | 0.175 | 0.216 | 0.148 | 0.240 |
| patchtst | baseline | 0.379 | 0.399 | 0.174 | 0.216 | 0.182 | 0.274 |
| timemixer | baseline | 0.377 | 0.397 | 0.162 | 0.209 | 0.156 | 0.247 |
| timexer | baseline | 0.388 | 0.406 | 0.157 | 0.205 | 0.141 | 0.243 |
| timexer | baseline | 0.386 | 0.405 | 0.159 | 0.206 | 0.140 | 0.242 |
| anthropic/claude-opus-4.6 | vanilla | 0.405 | 0.414 | 0.196 | 0.236 | 0.212 | 0.296 |
| deepseek-reasoner | vanilla | 0.513 | 0.510 | 0.201 | 0.284 | 0.236 | 0.346 |
| google/gemini-3.1-pro-preview | vanilla | 0.425 | 0.430 | 0.172 | 0.219 | 0.199 | 0.301 |
| openai/gpt-5.4-pro | vanilla | 0.386 | 0.401 | 0.176 | 0.217 | 0.176 | 0.264 |
| qwen/qwen3.6-plus:free | vanilla | 0.446 | 0.445 | 0.179 | 0.229 | 0.209 | 0.310 |
| anthropic/claude-opus-4.6 | agent | 0.397 | 0.408 | 0.195 | 0.235 | 0.202 | 0.284 |
| deepseek-reasoner | agent | - | - | - | - | - | - |
| deepseek-reasoner | agent | 0.507 | 0.483 | 0.174 | 0.224 | 0.186 | 0.294 |
| google/gemini-3.1-pro-preview | agent | 0.398 | 0.411 | 0.187 | 0.232 | 0.197 | 0.294 |
| openai/gpt-5.4-pro | agent | 0.390 | 0.404 | 0.172 | 0.211 | 0.168 | 0.257 |
| qwen/qwen3.6-plus:free | agent | 0.392 | 0.402 | 0.173 | 0.219 | 0.186 | 0.274 |