Highlights
corrupt() High-Level API
Accepts DataFrame, 2D array, or 1D array directly — handles standardization internally.
from tsrbench import CollectiveNoise
import pandas as pd
df = pd.read_csv("my_data.csv")
cn = CollectiveNoise(seed=2025)
results = cn.corrupt(df, noise_level=3, skip_first_col=True)
# results['shift'], results['spike'], results['impulse'],
# results['gaussian'], results['missing'], results['combined']skip_first_col=True— skip date/index column in DataFrameszero_clip=True— clip negatives to zero (e.g., electricity data)
6 Corruption Types
- Level Shift — sustained deviation over multiple time steps
- Exponential Spike — transient peak with exponential rise/fall
- Impulse — single-point EVT-calibrated spike
- Gaussian — additive N(0, σ) noise on every time step
- Missing — zero-valued dropout at independent positions
- Combined — union of Shift + Spike + Impulse
All anomaly positions are non-overlapping within a severity level (priority: Shift → Spike → Impulse → Missing).
Quickstart Notebook
examples/quickstart.ipynb — interactive examples for 1D, 2D, and DataFrame inputs with visualizations.
Install
pip install tsrbench==0.3.0