CARD: Channel Aligned Robust Blend Transformer for Time Series Forecasting
Paper • 2305.12095 • Published
Based on: CARD: Channel Aligned Robust Blend Transformer for Time Series Forecasting (ICLR 2024)
This model uses the CARD (Channel Aligned Robust Blend) Transformer architecture to predict NSE (National Stock Exchange of India) stock prices. Key innovations from the paper:
| Parameter | Value |
|---|---|
| Lookback Window | 96 trading days |
| Prediction Horizon | 5 trading days |
| Hidden Dim (d_model) | 64 |
| FFN Dim (d_ff) | 128 |
| Attention Heads | 8 |
| Encoder Layers | 2 |
| Patch Length | 16 |
| Stride | 8 |
| Token Blend Size | 2 |
| EMA Alpha | 0.9 |
| Dynamic Projection Rank | 8 |
| Dropout | 0.3 |
| Metric | Value |
|---|---|
| MSE | 0.039362 |
| MAE | 0.132980 |
| RMSE | 0.198398 |
RELIANCE, TCS, HDFCBANK, INFY, ICICIBANK, HINDUNILVR, SBIN, BHARTIARTL, KOTAKBANK, ITC, LT, AXISBANK, BAJFINANCE, ASIANPAINT, MARUTI, HCLTECH, SUNPHARMA, TITAN, ULTRACEMCO, WIPRO
import torch, json
from card_nse_predictor import CARD, CARDConfig
# Load config
with open("config.json") as f:
cfg = CARDConfig(**json.load(f))
# Load model
model = CARD(cfg)
model.load_state_dict(torch.load("model.pt", map_location="cpu"))
model.eval()
# Input: (batch, n_stocks, lookback_days) — raw close prices
# Output: (batch, n_stocks, pred_len) — predicted close prices
x = torch.randn(1, 20, 96)
pred = model(x)
print(pred.shape) # (1, 20, 5)
@inproceedings{xue2024card,
title={CARD: Channel Aligned Robust Blend Transformer for Time Series Forecasting},
author={Xue, Wang and Zhou, Tian and Wen, Qingsong and Gao, Jinyang and Ding, Bolin and Jin, Rong},
booktitle={International Conference on Learning Representations},
year={2024}
}