⚠️ Synthetic data. This model was trained and tested on a seeded synthetic month of elevator sensor readings, not on data from a real elevator. The public Kaggle set usually linked to this task (
shivamb/elevator-predictive-maintenance-dataset) has no failure label, so the training code generates a month that matches the brief. The numbers below say how well the model learns that generator's degradation pattern. They say nothing about real elevators.
From the last 60 minutes of 11 elevator sensors (one reading per minute), the model predicts whether the
elevator will be in a degradation/failure state 10 minutes later. It is a RandomForest (300 trees) on 63
features computed from the window. On the held-out test days of the synthetic month it scores F1 = 0.988
(168 of 170 failure windows caught, 2 false alarms among 1,156 healthy windows) at its tuned threshold of 0.38
(run of 2026-09-25, metrics.json). It beat a Keras 1D-CNN and a Keras LSTM trained on the raw windows.
temperature, humidity, vibration_rms, vibration_peak, motor_current, motor_rpm, door_cycles, load_kg, acoustic_db, oil_level, power_kw, as a CSV
path, CSV text, a DataFrame or a list of row dicts. The last 60 rows are used. An optional timestamp
column gives the time of the window end; without it a weekday noon is assumed.model.window_features, 63 in total): mean, std, min, max and least-squares slope of each
sensor over the window (55), the top-5 FFT magnitudes of vibration_rms (DC dropped) and its dominant
frequency bin (6), and the hour and day of week of the window end (2).rf.joblib): scikit-learn RandomForestClassifier, 300 trees, class_weight="balanced",
default depth, 10,408 tree nodes in total. P(failure) is the trees' vote share.config.json → threshold).predict(data): {"failure": p, "healthy": 1 - p}.config.json holds the sensors, window length, label lag, feature names, threshold and library versions.
model.py reads it all. No scaler is needed: trees are insensitive to feature scale.from huggingface_hub import hf_hub_download, snapshot_download
import sys
path = snapshot_download("shalev396/elevator-maintenance")
sys.path.insert(0, path)
import model
predictor = model.load(path, device="cpu") # CPU only (scikit-learn)
csv = hf_hub_download("shalev396/elevator-maintenance", "examples/degrading.csv", repo_type="space")
p = predictor.predict(csv) # {"failure": 0.92, "healthy": 0.08}
print(p, "maintenance" if p["failure"] >= predictor.threshold else "healthy")
Or call the hosted API: see the Space
(POST /gradio_api/call/predict with the CSV file).
Inference Endpoint: handler.py makes this repo deployable from its page (Deploy → Inference Endpoints).
Send {"inputs": "<CSV text with >= 60 rows>"} (or a list of row dicts, or {column: [values]}); the response
is {"failure": p, "healthy": 1 - p}.
training/src/data_setup.py, seed 42): 31 days x 1,440 minutes =
44,640 rows. A daily usage profile (morning, lunch and evening peaks, quiet nights, weekends at 35 %) drives
all sensors, plus noise. Five degradation episodes add 6-14 h of linear drift (vibration +1.8, peak
vibration +4.5, motor current +5 A, temperature +7 °C, noise +9 dB, power +2 kW, rpm -90, faster oil loss),
then a 45-120 min failure, then a maintenance reset. Status = 1 during degradation + failure: 8.5 % of
minutes. The anchors put three episodes in train and one each in validation and test.Status 10 min after the window, stride 5 min. A window and its label must lie in
the same segment, so nothing crosses a boundary. This gives 6,236 / 1,326 / 1,326 windows with
413 / 178 / 170 failure windows.Deployed RandomForest on the 1,326 test windows (the last 4.65 days, one unseen episode), threshold 0.377:
| metric (test) | value |
|---|---|
| f1 | 0.9882 |
| precision | 0.9882 |
| recall | 0.9882 |
| accuracy | 0.9970 |
| pr_auc | 0.9890 |
| roc_auc | 0.9927 |
Confusion (test): 168 true alarms, 2 missed failure windows, 2 false alarms, 1,154 correct "healthy".
Every variant, ranked in training order; bold = deployed. Size is weights for the Keras nets and tree nodes for the forest.
| experiment | size | val F1 | threshold | test F1 | test precision | test recall | test PR-AUC | train time |
|---|---|---|---|---|---|---|---|---|
| RandomForest (deployed) | 10,408 tree nodes | 0.9888 | 0.377 | 0.9882 | 0.9882 | 0.9882 | 0.9890 | 2.9 s |
| CNN-1D | 52,993 weights | 0.9117 | 0.189 | 0.9581 | 0.9756 | 0.9412 | 0.9380 | 64.5 s |
| LSTM | 23,681 weights | 0.9375 | 0.166 | 0.9329 | 0.9684 | 0.9000 | 0.9200 | 146.1 s |
The timeline shows the train episodes at a flat 1.0: those windows were in the training set, so the forest fits them perfectly. Only the orange (validation) and green (test) parts are out of sample.
timestamp column are
scored as weekday noon.Have the files? Publish a torrent.
Publish a torrentHave the complete files and permission to share them? Replace the example folder path. The script checks the files, makes a torrent and submits its magnet and checksums. Keep your torrent client seeding. Get your community key from your settings, and read the script before running it.
curl -fsSL https://pirateface.co/package.sh | bash -s -- --repo shalev396/elevator-maintenance ./model-folder