🔍 AutoAnomalyDetection
The First Fully Unified, Automated & Scalable Python Library for Intelligent Anomaly Detection
🚀 Overview
AutoAnomalyDetection is the world's first end-to-end, unified anomaly detection library that:
- Automatically determines detection mode (supervised, semi-supervised, unsupervised)
- Orchestrates ensembles of multiple algorithms
- Handles missing values intelligently
- Produces severity-based anomaly scoring
- Generates context-aware visualizations
- Provides a simple and clean Python API
✨ Key Features
🎯 Automatic Mode Selection
- Detects if data is supervised, semi-supervised, or unsupervised
- Seamlessly switches modes without user intervention
🤖 Multi-Algorithm Ensemble
Supports a wide range of methods:
| Category | Algorithms |
|---|---|
| Statistical | Z-Score, IQR, Gaussian Deviation |
| Distance-Based | Euclidean, Mahalanobis, Cosine, DTW |
| Proximity-Based | KNN, LOF, Isolation Forest |
| Clustering | KMeans, DBSCAN |
| Deep Learning | Autoencoders, LSTM, VAEs |
| Supervised | Random Forest, XGBoost, SVM |
🧠 Intelligent Data Handling
- Smart missing value detection & imputation
- Type inference for mixed numerical/categorical data
- Scales to millions of rows with optimized performance
📊 Advanced Visualization
- Context-aware anomaly plots
- Auto-zooming on abnormal regions
- Multi-panel layouts
- Downsampling for large datasets
🛠️ Installation
Basic Install
pip install autoanomalydetection
With Optional Deep Learning Dependencies
pip install autoanomalydetection[deeplearning]
Install From Source
git clone https://github.com/atharvjadhav1112/AutoAnomalyDetection.git
cd AutoAnomalyDetection
pip install -e .
📖 Quick Start
🔥 Basic Usage (3 Lines!)
import numpy as np
from autoanomalydetection import AutoAnomalyDetector
data = np.random.randn(1000, 5)
detector = AutoAnomalyDetector()
results = detector.fit_detect(data)
anomalies = detector.get_anomalies()
print(f"Detected {len(anomalies)} anomalies")
detector.visualize_results('overview')
🎯 Supervised Detection
import pandas as pd
from autoanomalydetection import AutoAnomalyDetector
df = pd.DataFrame(np.random.randn(1000, 4))
df['is_anomaly'] = np.random.choice([0, 1], 1000, p=[0.95, 0.05])
detector = AutoAnomalyDetector()
results = detector.fit_detect(df, target='is_anomaly')
print(f"Performance: {results['performance']}")
⚙️ Custom Configuration
config = {
'contamination': 0.05,
'n_models': 3,
'severity_levels': 5,
'use_deep_learning': False,
'ensemble_method': 'voting'
}
detector = AutoAnomalyDetector(config)
results = detector.fit_detect(data)
📈 Real-World Example (IoT Sensors)
import pandas as pd
import numpy as np
from autoanomalydetection import AutoAnomalyDetector
np.random.seed(42)
time_index = pd.date_range('2023-01-01', periods=1000, freq='H')
sensor_data = pd.DataFrame({
'timestamp': time_index,
'temperature': np.random.normal(25, 5, 1000),
'pressure': np.random.normal(100, 10, 1000),
'vibration': np.random.normal(5, 2, 1000)
})
sensor_data.loc[100:105, 'temperature'] = 50
sensor_data.loc[500:502, 'pressure'] = 200
detector = AutoAnomalyDetector({
'contamination': 0.01,
'n_models': 4,
'severity_levels': 3
})
results = detector.fit_detect(sensor_data[['temperature','pressure','vibration']])
print(f"Detected {results['summary']['total_anomalies']} sensor anomalies")
🏗️ Architecture
autoanomalydetection/
├── core/
│ ├── data_handler.py
│ ├── mode_selector.py
│ ├── model_manager.py
│ ├── scorer.py
│ └── visualizer.py
├── models/
│ ├── supervised.py
│ ├── semi_supervised.py
│ ├── unsupervised.py
│ ├── distance_based.py
│ └── deep_learning.py
└── utils/
├── config.py
├── metrics.py
└── logger.py
📊 Supported Data Types
| Type | Description | Examples |
|---|---|---|
| Tabular | Feature matrices | Fraud, QC |
| Time Series | Sequential data | IoT, network logs |
| High-Dimensional | Sparse/dense data | Genomics, images |
| Mixed-Type | Numeric + categorical | Healthcare, CRM |
| Large-Scale | Millions+ rows | Finance, IoT |
🎯 Use Cases
🔒 Cybersecurity
detector = AutoAnomalyDetector({
'contamination': 0.001,
'n_models': 5,
'severity_levels': 4
})
💰 Finance
detector = AutoAnomalyDetector({
'contamination': 0.01,
'use_deep_learning': True,
'ensemble_method': 'stacking'
})
🏭 IoT & Manufacturing
detector = AutoAnomalyDetector({
'contamination': 0.05,
'n_models': 3,
'severity_levels': ৩
})
⚡ Performance
| Metric | Value | Description |
|---|---|---|
| Max Dataset Size | 10M+ rows | Large-scale datasets |
| Processing Speed | 1M rows/min | Optimized engine |
| Memory Usage | Smart chunking | Memory-safe |
| Parallelization | Multi-core | Faster runtime |
🔬 Advanced Usage
Custom Model Selection
custom_methods = ['isolation_forest','local_outlier_factor','autoencoder']
detector = AutoAnomalyDetector()
results = detector.fit_detect(data, custom_methods=custom_methods)
Results Analysis
anomalies = detector.get_anomalies(threshold=0.95)
report = detector.get_detection_report()
detector.save_results('detection_results.pkl')
Visualization Options
fig1 = detector.visualize_results('overview')
fig2 = detector.visualize_results('severity_distribution')
fig3 = detector.visualize_results('feature_importance')
📋 Comparison with Existing Libraries
| Feature | PyOD | ADTK | Anomalib | AutoAnomalyDetection |
|---|---|---|---|---|
| Unified supervised + unsupervised | ❌ | ❌ | ❌ | ✅ |
| Automatic mode selection | ❌ | ❌ | ❌ | ✅ |
| Multi-Algorithm Ensemble | Partial | Partial | ❌ | ✅ |
| Missing value intelligence | ❌ | Partial | ❌ | ✅ |
| Context-aware visualization | ❌ | Partial | ❌ | ✅ |
| Large-scale production ready | Partial | Partial | ❌ | ✅ |
🤝 Contributing
We welcome PRs! Clone and install:
git clone https://github.com/atharvjadhav1112/AutoAnomalyDetection.git
cd AutoAnomalyDetection
pip install -e .
pip install -r requirements-dev.txt
Running Tests
pytest tests/
pytest --cov=autoanomalydetection tests/
pytest tests/test_core.py -v
📜 License
MIT License — see LICENSE file.
🙏 Acknowledgments
Built on scikit-learn, NumPy, Pandas
Inspired by PyOD, ADTK, Anomalib
Thanks to the open-source community ❤️
🔮 Roadmap
- AutoFeatureSelector
- Hyperparameter AutoML
- Streaming anomaly detection
- Distributed support (Dask/Spark)
- Streamlit/Dash dashboard
- Transformer-based anomaly detectors
- Anomaly explanation module
- Automated benchmarking
📊 Citation
@software{autonanomalydetection2024,
title={AutoAnomalyDetection: Unified Automated Anomaly Detection Library},
author={Jadhav, Atharv},
year={2024},
url={https://github.com/atharvjadhav1112/AutoAnomalyDetection}
}
⭐ If you find AutoAnomalyDetection useful, please give it a star!
Making anomaly detection accessible, automated, and accurate for everyone. 🚀
Metadata
Release files for autoanomalydetection 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| autoanomalydetection-0.1.0.tar.gz | 6.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| autoanomalydetection-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.8 kB
Release files / autoanomalydetection-0.1.0.tar.gz
| Download URL | autoanomalydetection-0.1.0.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ece583a464f9fe0fdeb88c61622bf8b777be8d8afd4206cd084fcd2b0d8fd334
|
|
BLAKE2b-256 checksum How to use checksums |
5f1e60bcb69332e22cc2d2e965974ff79e4c607582894abb4ad8bb1f829e4fc0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / autoanomalydetection-0.1.0-py3-none-any.whl
| Download URL | autoanomalydetection-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a6ae33e5c26a9bc7140de86840619d478b396f54d79c83661cca46489766711b
|
|
BLAKE2b-256 checksum How to use checksums |
6d014f43f6c0fc865648b5a04937a90554003f71c3c49c7fb50eafdd7df094ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|