Fast-BOCPD Documentation

The world’s fastest Bayesian online changepoint detection library.

Fast-BOCPD is 10-1,500x faster than competing implementations while providing a simple, Pythonic API for detecting regime changes in time series data.

PyPI Version License

Key Features

Blazing Fast
  • 14,000-43,000 observations/sec (depending on model)

  • 10x faster than optimized Cython implementations

  • 28x faster than Rust implementations

  • 1,500x faster than PyTorch implementations

7 Probabilistic Models
  • Gaussian, Student-t (outlier-robust)

  • Poisson (count data), Bernoulli/Binomial (binary/proportion data)

  • Gamma (positive continuous data)

  • All with conjugate priors for analytical updates

Flexible Processing
  • Online mode: Process data as it arrives (streaming)

  • Offline mode: Batch processing with 2-3x speedup

  • Smart truncation prevents O(n²) memory explosion

Pure Python Interface
  • Intuitive API that “just works”

  • High-performance C backend (transparent to users)

  • Full NumPy integration

Quick Example

Detect changepoints in 5 lines of code:

import fast_bocpd as fb
import numpy as np

# Generate data with a changepoint at t=100
data = np.concatenate([np.random.normal(0, 1, 100),
                       np.random.normal(5, 1, 100)])

# Detect changepoints
model = fb.GaussianNIG(mu0=0, kappa0=1, alpha0=1, beta0=1)
hazard = fb.ConstantHazard(lambda_=100)
detector = fb.BOCPD(model, hazard)

results = detector.batch_update(data)
changepoints = results.get_changepoints(threshold=0.5)

print(f"Detected changepoint at: {changepoints}")
# Output: Detected changepoint at: [100]

Installation

pip install fast-bocpd

Or from source:

git clone https://github.com/TiaanViviers/Fast_BOCPD.git
cd Fast_BOCPD
pip install -e .

Documentation Contents

Community & Support

License

Fast-BOCPD is released under the MIT License. See the LICENSE file for details.

Citation

If you use Fast-BOCPD in your research, please cite:

@software{fastbocpd2025,
  title = {Fast-BOCPD: High-Performance Bayesian Online Changepoint Detection},
  author = {Tiaan Viviers},
  year = {2025},
  url = {https://github.com/TiaanViviers/Fast_BOCPD},
  version = {1.0.0}
}

Indices and Tables