Crate Hierarchy#
changepoint-doctor is organized as a Cargo workspace with 10 crates, each with a focused responsibility.
Dependency graph#
graph TD
core[cpd-core]
costs[cpd-costs]
preprocess[cpd-preprocess]
offline[cpd-offline]
online[cpd-online]
doctor[cpd-doctor]
python[cpd-python]
cli[cpd-cli]
bench[cpd-bench]
eval[cpd-eval]
costs --> core
preprocess --> core
offline --> core
offline --> costs
online --> core
online --> costs
doctor --> core
doctor --> costs
doctor --> offline
doctor --> online
doctor --> preprocess
python --> core
python --> costs
python --> offline
python --> online
python --> doctor
python --> preprocess
cli --> doctor
bench --> core
bench --> costs
bench --> offline
bench --> online
eval --> core
eval --> offline
eval --> online
Per-crate responsibilities#
cpd-core#
Foundation types shared across the workspace:
TimeSeriesView<'a>: zero-copy borrowed view over signal data with layout, missing policy, and time indexCpdError: unified error type with variants for invalid input, resource limits, cancellation, and algorithm failuresExecutionContext: constraints, cancellation token, budget mode, repro mode, progress/telemetry sinksConstraints: min_segment_len, jump, max_change_points, budget controlsOfflineChangePointResult,OnlineStepResult: result typesDiagnostics,PruningStats: metadataReproMode: strict/balanced/fast reproducibility contractsNumeric utilities: log_sum_exp, stable_mean, Kahan summation, prefix sums
cpd-costs#
All cost model implementations:
CostModeltrait andCachedCost<C>wrapperImplementations:
CostL2Mean,CostL1Median,CostNormalMeanVar,CostNormalFullCov,CostNIGMarginal,CostAR,CostBernoulli,CostPoissonRate,CostRank,CostCosine
cpd-preprocess#
Signal preprocessing pipeline:
Detrend (linear, polynomial)
Deseasonalize (differencing, STL-like)
Winsorize
Robust scale (MAD-based)
cpd-offline#
Offline (batch) detector implementations:
Pelt,BinSeg,Fpop,Dynp(SegNeigh),Wbs,BottomUp,SlidingWindowEach implements the
OfflineDetectortrait from cpd-coreExperimental:
KernelCpd,GpCpd,ArgpCpd(feature-gated)
cpd-online#
Online (streaming) detector implementations:
Bocpdwith conjugate observation models (GaussianNigPrior,BernoulliBetaPrior,PoissonGammaPrior)Cusum,PageHinkleyEach implements the
OnlineDetectortrait from cpd-coreCheckpoint/restore via
save_state()/load_state()
cpd-doctor#
Recommendation engine:
Signal diagnostics (distribution shape, autocorrelation, seasonality, missing patterns)
Calibration families and per-family scoring
Pipeline ranking with confidence intervals
Preprocessing recommendations
Pipeline execution helpers
cpd-python#
PyO3 extension module:
Python class wrappers for all detectors
NumPy array interop for
TimeSeriesViewGIL-release strategy for batched operations
Result serialization/deserialization
Module:
cpd._cpd_rs
cpd-cli#
Command-line interface:
cpd doctorfor recommendation workflowsCSV input, JSON output
cpd-bench#
Criterion benchmark harness:
Offline detector benchmarks (various n, k, cost combinations)
Cost model benchmarks (univariate + multivariate)
SegNeigh scaling benchmarks
cpd-eval#
Evaluation framework:
Parity testing against reference implementations (ruptures, bayesian_changepoint_detection)
Corpus management and metric computation
Build configuration#
Setting |
Value |
|---|---|
Rust edition |
2024 |
MSRV |
1.93 |
Resolver |
2 |
License |
MIT OR Apache-2.0 |
PyO3 |
0.24.1 with abi3-py39 |
Feature flags#
Feature |
Crates affected |
Description |
|---|---|---|
|
cpd-offline |
Parallel execution for supported algorithms |
|
cpd-core, cpd-costs, cpd-offline, cpd-online, cpd-doctor |
JSON serialization |
|
cpd-core, cpd-offline, cpd-online |
Structured logging |
|
cpd-costs |
SIMD-accelerated numeric kernels |
|
cpd-offline, cpd-costs |
Kernel-based detection (experimental) |
|
cpd-offline, cpd-costs |
Approximate kernel methods |
|
cpd-costs |
BLAS-accelerated linear algebra |
|
cpd-offline, cpd-costs |
Gaussian process detection (experimental) |
|
cpd-preprocess, cpd-doctor, cpd-python |
Signal preprocessing |
|
cpd-costs |
Deterministic numeric paths for strict mode |