Anomaly detection by making LSTM and VAE share a cubicle
A 2020 ICASSP paper that chains a variational autoencoder to an LSTM so each handles the time-scale it actually understands.

What it does
This repo implements a hybrid model for spotting weirdness in time series without labeled anomalies. A VAE compresses short windows of data into low-dimensional embeddings; an LSTM then watches those embeddings unfold over longer horizons. The reconstruction error becomes your anomaly score. It ships with pre-processed Numenta Anomaly Benchmark (NAB) data and a notebook to set detection thresholds by eyeballing histograms.
The interesting bit
The architecture is essentially a division of labor by attention span: the VAE handles local structure, the LSTM handles temporal drift. The authors published this at ICASSP 2020, and the code is pure TensorFlow 1.5 — a version now old enough to vote in some countries.
Key highlights
- Pre-processed NAB datasets included; training set is guaranteed anomaly-free, test set keeps the known anomalies
- Config-driven training via
NAB_config.json; model files split acrosstrain.py,models.py,trainers.py, etc. - Jupyter notebook (
NAB-anomaly-detection.ipynb) walks through inference and threshold selection - Reproduces the paper’s office-temperature detection example out of the box
Caveats
- TensorFlow 1.5 dependency means you’ll likely need a dedicated virtualenv or Docker time capsule
- Threshold setting is manual: “observe the histogram and set accordingly” — no automatic calibration provided
- Code structure is somewhat scattered across seven files in
codes/
Verdict
Worth a look if you’re researching hybrid VAE-RNN architectures or need a reproducible baseline from the anomaly-detection literature. Skip it if you want production-ready code with modern frameworks or automatic threshold tuning.