Downloads · 30 days
18
14% of all-time downloads
DrAdrianDC/wti-lstm-autoencoder
wti-lstm-autoencoder is a machine learning model from DrAdrianDC. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for keras. The card lists the license as mit.
Unsupervised reconstruction-error model for daily WTI futures (CL=F). The network reconstructs 10-day windows of causally vol-normalized ΔClose (USD/bbl). A window is flagged when its reconstruction MSE exceeds the 99…
Downloads · 30 days
18
14% of all-time downloads
All-time downloads
131
Public
Repo size
4.7 MB
Likes
0
Public
Click a slice to open those files.
.csv1.1 MB · 46%
From the Hugging Face model README
Unsupervised reconstruction-error model for daily WTI futures (CL=F). The network reconstructs 10-day windows of causally vol-normalized ΔClose (USD/bbl). A window is flagged when its reconstruction MSE exceeds the 99th percentile of quiet calibration MSE (2010–2019). That threshold is frozen at 0.382. 2008 is a historical holdout (not in the loss). 2020–present is out of sample.
This is a shape-break score, not a crisis classifier and not a forecast. A rolling 10-day vol rule and a one-day robust z-score are published next to it at the same P99 budget. Training and scoring live in DrAdrianDC/WTI_Anomaly_Detection.
| File | Role |
|---|---|
lstm_autoencoder.keras | Keras 3 weights + graph |
feature_state.json | Frozen floor, lookbacks, P99 baselines. JSON, not pickle |
metadata.json | Threshold, MAE, evaluation |
reconstruction_scores.csv | Per-day scores + flags |
detected_anomalies.csv | LSTM-flagged days |
plot-anomalies.png | Price + flags |
plot-reconstruction-error.png | Log MSE vs P99 |
CL=F, unadjusted close(batch, 10, 1) of ( x_t = \Delta\mathrm{Close}_t / \max(\mathrm{causal\ 60d\ MAD},\ 0.66) )last_date: 2026-09-10P99 is of quiet train MSE, not of live days. Rank (M=\log_{10}(\mathrm{MSE}/\mathrm{threshold})); do not treat the 0/1 as a 1% live rate.
import json
from huggingface_hub import hf_hub_download
from tensorflow import keras
repo_id = "DrAdrianDC/wti-lstm-autoencoder"
model = keras.models.load_model(hf_hub_download(repo_id, "lstm_autoencoder.keras"))
state = json.loads(open(hf_hub_download(repo_id, "feature_state.json")).read())
threshold = json.load(open(hf_hub_download(repo_id, "metadata.json")))["threshold"]
# Build windows with the GitHub package (`src.features.build_feature_frame`)
# so the causal MAD matches training. Do not use a global scaler.
There is no Transformers pipeline() for this checkpoint.
train.Research and portfolio demonstration. Not for automated trading. If the flag fires on a live print, check CME before the model.