Deep Autoencoder that learns normal time-series patterns and detects unusual signals better than classical ML.
A compact implementation of a deep autoencoder for anomaly detection in time-series data. This project trains an autoencoder to learn "normal" patterns and flags deviations as anomalies. It's intended as a research / demo repository with a minimal runnable entrypoint (main.py) and simple result logging (results/results.txt).
Key idea: an autoencoder compresses and reconstructs inputs. Large reconstruction errors indicate inputs that differ from the learned normal behavior and can be treated as anomalies.
Status: Minimal demo — see main.py and results/results.txt for how experiments are run and results are recorded.
Table of Contents
- Project: Overview and goals
- Requirements: Python packages needed
- Installation: how to set up the environment
- Quick Start: run training and inference
- Files: important files in the repo
- Configuration: how to adapt dataset and hyperparameters
- Results: where outputs are written and how to interpret them
- Contributing and License
- Python 3.8+ recommended
- See
requirements.txtfor exact package versions
To install dependencies:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtIf you use a GPU, ensure you have the appropriate CUDA/cuDNN and the matching torch wheel (if torch is a dependency).
- Install requirements (see above).
- Prepare your dataset (see the Configuration section).
- Run the main script:
# Train model (default behavior depends on the implementation in main.py)
python main.py
# If your main.py supports flags, try:
# python main.py --train --data path/to/data.csv --out results/After running, check results/results.txt for logged metrics and experiment notes.
main.py— project entrypoint. Trains / evaluates the autoencoder and writes results.requirements.txt— Python dependencies for reproducible environment.results/— output folder containingresults.txtwith run summaries.README.md— this file.
If you add datasets or checkpoints, place them in a separate data/ or checkpoints/ folder and update main.py accordingly.
This repository uses a minimal configuration. To adapt the project:
- Edit
main.pyto change model architecture, optimizer, or training loop. - Add a command-line argument parser (e.g.,
argparse) if not present — sample flags:--train,--eval,--data,--epochs,--batch-size,--lr,--seed. - Ensure data is scaled/normalized consistently (autoencoders are sensitive to input scale).
The project expects time-series data representing normal and (optionally) anomalous sequences. Typical preprocessing steps:
- Window the time-series into fixed-length sequences
- Normalize each feature (standardization or min-max)
- Provide training data containing mostly normal examples; use held-out data with anomalies for evaluation
If you don't yet have a dataset, synthesize simple signals (sinusoids + noise) and inject spikes or drifts as anomalies to test the pipeline.
- The repository writes summary information to
results/results.txt. - Typical metrics: reconstruction error distribution, precision/recall at chosen thresholds, AUC (ROC or PR) if labels are available.
How to interpret results/results.txt:
- Look for average reconstruction error on validation data (normal vs anomalous).
- Larger gaps between normal and anomalous error distributions generally indicate better separability.
The results/ folder contains visualizations created during experiments. Examples:
-
Reconstruction error distribution: shows the distribution of reconstruction errors for normal vs anomalous samples.
-
Reconstruction error panels: multi-panel view showing per-sequence errors or multiple experimental conditions.
- Fix random seeds for NumPy, PyTorch/TensorFlow, and Python's
randommodule. - Record package versions (
pip freeze > requirements.txt) and hardware used. - Save model checkpoints so you can re-evaluate or inspect reconstructions.
Contributions are welcome. Suggested workflow:
- Fork the repository.
- Create a feature branch:
git checkout -b feature/your-feature. - Add tests or runnable examples for large changes.
- Open a pull request describing your changes.
Please keep changes focused and include small reproducible examples when possible.
This repository does not include an explicit license file. If you want to make it public, add a LICENSE (e.g., MIT) to clarify reuse terms.
For questions or help, open an issue in the repository or contact the maintainer.

