https://github.com/rishishanthan/anomaly-detection-autoencoders
Anomaly detection with Dense, LSTM, and Conv1D autoencoders β reconstruction error, adaptive thresholds, ROC/PR analysis, and error heatmaps.
https://github.com/rishishanthan/anomaly-detection-autoencoders
ae anomaly-detection autoencoder conv1d deep-learning lstm-autoencoder pytorch reconstruction-error time-series unsupervised-learning
Last synced: about 1 month ago
JSON representation
Anomaly detection with Dense, LSTM, and Conv1D autoencoders β reconstruction error, adaptive thresholds, ROC/PR analysis, and error heatmaps.
- Host: GitHub
- URL: https://github.com/rishishanthan/anomaly-detection-autoencoders
- Owner: rishishanthan
- Created: 2025-10-08T02:26:17.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-10-08T02:49:28.000Z (8 months ago)
- Last Synced: 2025-10-08T04:19:38.115Z (8 months ago)
- Topics: ae, anomaly-detection, autoencoder, conv1d, deep-learning, lstm-autoencoder, pytorch, reconstruction-error, time-series, unsupervised-learning
- Language: Jupyter Notebook
- Homepage:
- Size: 2.06 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Anomaly Detection with Autoencoders (Dense, LSTM, Conv1D)
Three autoencoder variants for detecting anomalies using **reconstruction error**:
- **Dense AE** for tabular signals
- **LSTM AE** for sequential data
- **Conv1D AE** for local temporal patterns
The notebook provides a clean, comparative pipeline with reproducible metrics and visual diagnostics.
---
## π Approach
1) **Data prep** (windowing/standardization if time series)
2) **Train AEs** on normal data (or normal-heavy data)
3) **Compute reconstruction error** on val/test
4) **Choose threshold** (e.g., val quantile, Youdenβs J, or F1-max)
5) **Evaluate**: ROC-AUC, PR-AUC, Accuracy, F1; visualize error distributions
6) **Explain errors**: overlay recon vs. original; error heatmaps
---
## π§ Models
- **Dense AE**: MLP encoder/decoder with bottleneck (e.g., 128β32β128)
- **LSTM AE**: Encoder LSTM β bottleneck β Decoder LSTM
- **Conv1D AE**: Temporal conv blocks + upsampling/transposed conv
**Loss:** MSE
**Optimizer:** Adam (lr=1e-3)
**Regularization:** Dropout/weight decay as needed
**Early stopping** on val reconstruction loss
---
## π Insights
- Picking threshold on validation avoids test leakage
- LSTM AE shines with temporal drift; Conv1D with local bursts
- Robust standardization and window size are key hyperparameters
---
## π Results
All the results from my run which of test, train, validation reults including data analysis and corellations are in notebook.
---
## π Dataset
The dataset I used in the folder called 'NAB'. There are many other datasets in the folder, which can be tried out for improvement and practice purposes.