Skip to main content

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

Python License PRs Welcome


๐Ÿš€ 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autoanomalydetection-0.1.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autoanomalydetection-0.1.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

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

Hashes for autoanomalydetection-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ece583a464f9fe0fdeb88c61622bf8b777be8d8afd4206cd084fcd2b0d8fd334
MD5 385b0ce408c7e7963162f586ac344213
BLAKE2b-256 5f1e60bcb69332e22cc2d2e965974ff79e4c607582894abb4ad8bb1f829e4fc0

See more details on using hashes here.

File details

Details for the file autoanomalydetection-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for autoanomalydetection-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a6ae33e5c26a9bc7140de86840619d478b396f54d79c83661cca46489766711b
MD5 6eb2143af23b8f172d6da6df979ed230
BLAKE2b-256 6d014f43f6c0fc865648b5a04937a90554003f71c3c49c7fb50eafdd7df094ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page