pyharbinger
Python port of the R harbinger — a framework for time series event detection (anomalies, change points, and motifs/discords), built on the DAL Toolbox Experiment Line.
pyharbinger unifies many detection methods under one interface (fit → detect →
evaluate) and a common evaluation protocol, so different detectors can be compared fairly —
reusing classic libraries (scikit-learn, numpy, pandas, scipy, ruptures) through thin
adapters.
It is the capstone of the DAL Python family:
- Builds on pydaltoolbox (foundation) and pytspredit (time series prediction) — its regressors power the forecasting-based anomaly detectors.
Installation
pip install pyharbinger
Quickstart
from pyharbinger import HanrFft, HarEval, datasets
# a labeled example series (one injected anomaly)
dataset = datasets.examples_anomalies()["simple"]
serie, event = dataset["serie"], dataset["event"]
# fit -> detect -> evaluate
model = HanrFft().fit(serie)
detection = model.detect(serie)
print(detection[detection["event"]])
metrics = model.evaluate(detection, event)
print(metrics["confMatrix"])
print("F1:", metrics["F1"])
What's included (v1)
Every detector extends Harbinger and returns a detection table with columns
idx / event / type ("anomaly", "changepoint", "discord" or "").
| Group | Classes |
|---|---|
| Core | Harbinger (base contract), deviation / filter / candidate-selection utilities |
| Evaluation | HarEval (hard), HarEvalSoft (SoftED, soft matching via the Hungarian algorithm) |
| Anomaly | HanrMl (forecasting residuals, wraps a pytspredit regressor), HanrFft, HanrHistogram, HanrFbiad |
| Change point | HcpAmoc, HcpBinseg, HcpPelt (via ruptures), HcpKswin, HcpPageHinkley |
| Clustering | HanctKmeans (anomalies / discords) |
| Datasets | datasets.examples_anomalies(), datasets.examples_changepoints() |
Deferred to a future release (0.2.0 / Block B)
ML-classification detector (hanc_ml), motif/discord via matrix profile
(hdis_mp/hmo_mp), ARIMA/GARCH/EMD/wavelet anomaly detectors, DTW clustering,
SAX representations, ensembles, streaming/online runners, and plotting helpers.
Faithfulness to R
The port is validated against the R package on the same data at every step.
Deterministic components match R to numerical precision (deviation measures,
filters, candidate selection, hard/soft evaluation, FFT/histogram/FBIAD
detectors, HanrMl with a deterministic regressor, HanctKmeans centroids
count, and HcpPageHinkley). Where the backend or RNG differs, the tolerance is
documented:
HanrMlwith a rank-reduced ELM (nhid < input_size,purelin) depends on the hidden-weight RNG.HanctKmeansandHcpKswindepend on initialization / random-subsample RNG.HcpAmoc/HcpBinseg/HcpPeltuseruptures(Gaussian cost); R useschangepoint::cpt.meanvarwith the MBIC penalty, so agreement is approximate.
Related DAL projects
- pydaltoolbox — foundation (Python)
- pytspredit — time series prediction (Python)
- daltoolbox / tspredit / harbinger — R originals
- Data Analytics Lab
License
MIT
Metadata
Release files for pyharbinger 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 | Provenance | Actions |
|---|---|---|---|---|
| pyharbinger-0.1.0.tar.gz | 87.7 kB | Without provenance | Details for pyharbinger-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyharbinger-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pyharbinger-0.1.0-py3-none-any.whl |
Total release size: 174.5 kB
Release files / pyharbinger-0.1.0.tar.gz
| Download URL | pyharbinger-0.1.0.tar.gz |
|---|---|
| Size | 87.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8cbda307ad75ef465d2c577606e8a88aade811be52bbc5767c718f7ef2c6c813
|
|
BLAKE2b-256 checksum How to use checksums |
321c4aa352f106494afd7b7f07ea69a1c79aa3fa5aa2f679a7b2ee8f0c6d1184
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.0
|
Release files / pyharbinger-0.1.0-py3-none-any.whl
| Download URL | pyharbinger-0.1.0-py3-none-any.whl |
|---|---|
| Size | 86.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6f36b203c7e9e9b5a0d27cf9cfd0c998977e6c661380e9b6d751169e9b5e25dc
|
|
BLAKE2b-256 checksum How to use checksums |
5d1c19a090496f00b30f2e5e6eae363e64510fee0516df1ab6d82badb8131d87
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.0
|
Security for pyharbinger 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.