Downloads · 30 days
6
10% of all-time downloads
justanitin/card-nse-stock-predictor
card-nse-stock-predictor is a time series forecasting model from justanitin. Use it for the time series forecasting task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
Based on: CARD: Channel Aligned Robust Blend Transformer for Time Series Forecasting (ICLR 2024)
Downloads · 30 days
6
10% of all-time downloads
All-time downloads
61
Public
Repo size
921 KB
Likes
0
Public
Click a slice to open those files.
.pt921 KB · 99%
From the Hugging Face model README
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}
}