The First Fully Unified, Automated, and Scalable Python Library for Intelligent Anomaly Detection
Project description
๐ 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. ๐
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file autoanomalydetection-0.1.0.tar.gz.
File metadata
- Download URL: autoanomalydetection-0.1.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ece583a464f9fe0fdeb88c61622bf8b777be8d8afd4206cd084fcd2b0d8fd334
|
|
| MD5 |
385b0ce408c7e7963162f586ac344213
|
|
| BLAKE2b-256 |
5f1e60bcb69332e22cc2d2e965974ff79e4c607582894abb4ad8bb1f829e4fc0
|
File details
Details for the file autoanomalydetection-0.1.0-py3-none-any.whl.
File metadata
- Download URL: autoanomalydetection-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6ae33e5c26a9bc7140de86840619d478b396f54d79c83661cca46489766711b
|
|
| MD5 |
6eb2143af23b8f172d6da6df979ed230
|
|
| BLAKE2b-256 |
6d014f43f6c0fc865648b5a04937a90554003f71c3c49c7fb50eafdd7df094ad
|