CodeDevX commited on
Commit
bbfeada
·
verified ·
1 Parent(s): 6fbc6b0

Update model card: leak-free training, honest backtest metrics

Browse files
Files changed (1) hide show
  1. README.md +31 -48
README.md CHANGED
@@ -7,79 +7,62 @@ tags:
7
  - lstm
8
  - multi-task
9
  - multi-domain
10
- - text-generation
11
- pipeline_tag: text-generation
12
  ---
13
 
14
  # Future Prediction Models (Multi-Domain LSTM)
15
 
16
- Trained PyTorch LSTM checkpoints forecasting 7 daily time-series domains (AI/NVIDIA, Programming/npm, Finance/BTC, Sports/ATP Elo, Weather/Chennai, Economy/S&P500, Energy/WTI).
 
 
17
 
18
  ## Checkpoints
19
 
20
- All models predict 7 steps from a 60-step window of base-normalized values `x_t = value_t / value_{t-1} - 1`.
21
 
22
- | File | Parameters (hidden, layers, dropout) |
23
  |---|---|
24
- | `unified_model.pt` | Multi-task: shared LSTM (128, 2) + domain embedding (16) + 7 heads; domains: ai, programming, finance, sports, weather, economy, energy |
25
- | `model_ai.pt` | 128 hidden, 3 layers, dropout 0.1 |
26
- | `model_finance.pt` | 128 hidden, 3 layers, dropout 0.1 |
27
- | `model_programming.pt` | 128 hidden, 3 layers, dropout 0.1 |
28
- | `model_sports.pt` | 128 hidden, 3 layers, dropout 0.1 |
29
- | `model_economy.pt` | 64 hidden, 2 layers, dropout 0.1 |
30
- | `model_energy.pt` | 64 hidden, 2 layers, dropout 0.1 |
31
- | `model_weather.pt` | 64 hidden, 2 layers, dropout 0.1 |
32
-
33
- ## Model architecture (reference)
34
 
35
- ```python
36
- class LSTMForecaster(nn.Module):
37
- def __init__(self, input_size=1, hidden_size=128, num_layers=3, dropout=0.1, horizon=7):
38
- ...
39
- self.lstm = nn.LSTM(input_size, hidden_size, num_layers, batch_first=True, dropout=...)
40
- self.head = nn.Sequential(nn.Linear(hidden_size, hidden_size), nn.ReLU(),
41
- nn.Dropout(dropout), nn.Linear(hidden_size, horizon))
42
- def forward(self, x): # x: (B, 60, 1)
43
- out, _ = self.lstm(x)
44
- return self.head(out[:, -1, :]) # (B, 7)
45
- ```
46
 
47
- The unified model shares the LSTM across all 7 domains, adds a 16-dim domain embedding, and keeps one output head per domain (input and output shapes are the same as above).
48
 
49
- ## Validated accuracy (held-out test split, 1-day-ahead MAPE)
 
 
 
 
 
 
 
 
50
 
51
- | Topic | Separate | Unified |
52
- |---|---|---|
53
- | AI | 1.86% | 2.36% |
54
- | Programming | 7.12% | 5.42% |
55
- | Finance | 1.52% | 1.74% |
56
- | Sports | 0.06% | 0.04% |
57
- | Weather | 0.18% | 0.18% |
58
- | Economy | 0.64% | 0.75% |
59
- | Energy | 2.83% | 1.90% |
60
 
61
- ## Loading and inference
62
 
63
  ```python
64
  import torch
65
 
66
  model = torch.load("model_ai.pt", weights_only=False)
67
  model.eval()
68
- x = torch.randn(1, 60, 1) # last 60 normalized returns
69
  pred = model(x) # (1, 7) predicted returns over next 7 steps
70
  ```
71
 
72
- Example — reconstruct absolute values from predicted returns:
73
-
74
- ```python
75
- preds = model(x)[0] # 7 predicted returns
76
- forecast = current_value * torch.cumprod(1 + preds, 0) # 7-day forecast
77
- ```
78
-
79
  ## Notes
80
 
81
- - Forecasts are statistical estimates validated on held-out data; no model can predict the future with 100% accuracy.
82
- - Trained on CPU (PyTorch); goal was accuracy, not speed.
 
83
 
84
  ## License
85
 
 
7
  - lstm
8
  - multi-task
9
  - multi-domain
10
+ pipeline_tag: time-series-forecasting
 
11
  ---
12
 
13
  # Future Prediction Models (Multi-Domain LSTM)
14
 
15
+ Trained PyTorch LSTM checkpoints forecasting 7 daily time-series domains (AI/NVIDIA, Programming/npm, Finance/BTC, Sports/ATP Elo, Weather, Economy/S&P500, Energy/WTI).
16
+
17
+ Trained with a leak-free protocol: chronological TRAIN/VALIDATION/TEST splits, validation-only early stopping and tuning, untouched test set, and walk-forward backtesting as the headline metric.
18
 
19
  ## Checkpoints
20
 
21
+ All models predict 7 steps from a 60-step window. Inputs are 7 causal features per timestep: base-relative value, 1-step return, MA7 ratio, MA30 ratio, 7-step volatility, day-of-week sin/cos.
22
 
23
+ | File | Architecture |
24
  |---|---|
25
+ | `unified_model.pt` | Multi-task: shared LSTM (128 hidden, 2 layers) + domain embedding (16) + 7 heads; domains: ai, programming, finance, sports, weather, economy, energy |
26
+ | `model_ai.pt` | LSTM 64 hidden, 2 layers |
27
+ | `model_programming.pt` | LSTM 64 hidden, 2 layers |
28
+ | `model_finance.pt` | LSTM 64 hidden, 2 layers |
29
+ | `model_sports.pt` | LSTM 64 hidden, 2 layers |
30
+ | `model_weather.pt` | LSTM 64 hidden, 2 layers |
31
+ | `model_economy.pt` | LSTM 64 hidden, 2 layers |
32
+ | `model_energy.pt` | LSTM 64 hidden, 2 layers |
 
 
33
 
34
+ ## Honest performance (walk-forward backtest vs naive persistence)
 
 
 
 
 
 
 
 
 
 
35
 
36
+ Positive = model beats "tomorrow equals today" baseline.
37
 
38
+ | Topic | vs naive (separate) | vs naive (unified) | Verdict |
39
+ |---|---|---|---|
40
+ | Programming | +71% | +68% | Real edge (weekly seasonality) |
41
+ | AI | +2.3% | +1.6% | Small edge |
42
+ | Energy | +1.8% | +0.9% | Small edge |
43
+ | Economy | +0.3% | +2.0% | Marginal |
44
+ | Weather | -1.3% | -0.2% | No edge |
45
+ | Finance | -4.3% | -2.3% | Trails naive |
46
+ | Sports | -11.9% | -22.8% | Trails naive |
47
 
48
+ Directional accuracy is ~50-55% on financial series (barely better than chance). Sports direction is mostly undefined because Elo is flat on no-match days.
 
 
 
 
 
 
 
 
49
 
50
+ ## Loading
51
 
52
  ```python
53
  import torch
54
 
55
  model = torch.load("model_ai.pt", weights_only=False)
56
  model.eval()
57
+ x = torch.randn(1, 60, 7) # last 60 steps of the 7 causal features
58
  pred = model(x) # (1, 7) predicted returns over next 7 steps
59
  ```
60
 
 
 
 
 
 
 
 
61
  ## Notes
62
 
63
+ - Forecasts are statistical estimates; no model predicts the future reliably.
64
+ - Uncertainty bands shipped with predictions come from validation residual std (+/-1.96 sigma), not invented confidence.
65
+ - Where the model does not beat the persistence baseline, that is reported rather than hidden.
66
 
67
  ## License
68