pyculiar

A minimal pure python port of Twitter's AnomalyDetection R Package

Python MIT
30 Stars
16 Forks
0 Issues

Languages

Python 66.5% C 33.5%

Recent Activity

Last 12 weeks

Top Contributors

Project Info

Created
September 9, 2015
Last Updated
February 16, 2026
License
MIT
Default Branch
master

About This Project

Pyculiar implements S-H-ESD (Seasonal Hybrid Extreme Studentized Deviate) for detecting anomalies in time series data. It’s a minimal pure Python port of Twitter’s AnomalyDetection R package, with only numpy and pandas as dependencies.

Features

  • S-H-ESD Algorithm: Seasonal Hybrid ESD for robust anomaly detection
  • Minimal Dependencies: Only numpy and pandas required
  • Direction Control: Detect positive, negative, or both types of anomalies
  • Configurable Granularity: Day, hour, minute, second, or millisecond
  • Threshold Filtering: Optional filtering thresholds and expected value output
  • C Performance: Core algorithm implemented in C for speed

Installation

pip install pyculiar

Quick Start

from pyculiar import detect_ts
import pandas as pd

# DataFrame with two columns: unix timestamps and values
df = pd.read_csv("your_timeseries.csv")
results = detect_ts(df, max_anoms=0.02, direction="both", alpha=0.05)

Key parameters include max_anoms (0.0-0.49 for maximum anomaly proportion), alpha (significance threshold), direction (pos, neg, or both), and granularity for time resolution.