helloadhavan commited on
Commit
55b441c
·
verified ·
1 Parent(s): 6cb1024

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +56 -1
README.md CHANGED
@@ -11,4 +11,59 @@ tags:
11
  - time-series
12
  - stock-prediction
13
 
14
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  - time-series
12
  - stock-prediction
13
 
14
+ ---
15
+
16
+ # LSTM Stock Next-Day Predictor
17
+
18
+ This model was trained on the [Stock-Pile dataset](https://huggingface.co/datasets/helloadhavan/Stock-pile). It is a custom LSTM architecture with a learned ticker embedding, trained on about 5 million rows of daily stock data covering hundreds of companies across US, European and Asian markets. Given the previous 30 trading days, it predicts the next day's Open, High, Low, Close and log-Volume. It is a learning and experimentation project, not financial advice.
19
+
20
+ ## Files
21
+
22
+ | File | Purpose |
23
+ |---|---|
24
+ | `loader.py` | `Model`, `Normalizer` and `load_model` |
25
+ | `config.json` | Ticker ids, per-ticker normalization statistics and training logs |
26
+ | `stock_predictor/model.pth` | Trained weights |
27
+ | `MODEL_CARD.md` | Architecture, data, evaluation and limitations |
28
+
29
+ ## Usage
30
+
31
+ Download the repo by running:
32
+ ```bash
33
+ huggingface-cli download helloadhavan/stock-LSTM
34
+ ```
35
+
36
+ ```python
37
+ import torch
38
+ from .stock-LSTM.loader import load_model, Normalizer
39
+
40
+ model = load_model("stock_predictor/model.pth", "config.json")
41
+ normalizer = Normalizer("config.json")
42
+
43
+ window = {
44
+ "Open": open_t,
45
+ "High": high_t,
46
+ "Low": low_t,
47
+ "Close": close_t,
48
+ "Volume": torch.log1p(volume_t),
49
+ }
50
+
51
+ x = normalizer(window, "AAPL")
52
+ ticker_id = normalizer.ticker_ids["AAPL"]
53
+ ids = torch.full((x.shape[0], 1), float(ticker_id))
54
+ inputs = torch.cat([x, ids], dim=-1).unsqueeze(0)
55
+
56
+ with torch.no_grad():
57
+ prediction = model(inputs)
58
+
59
+ result = normalizer.denormalize(prediction[0], "AAPL")
60
+ result["Volume"] = torch.expm1(result["Volume"])
61
+ ```
62
+
63
+ Each tensor in `window` has shape `(30,)`. `denormalize` returns a dict of prices and log-Volume, so apply `torch.expm1` to get raw volume.
64
+
65
+ ## Notes
66
+
67
+ - Volume must be `log1p`-transformed before normalizing.
68
+ - Only tickers listed in `config.json` are supported.
69
+ - See `MODEL_CARD.md` for limitations and evaluation details.