1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! Changepoint detection algorithms.
//!
//! Provides methods to detect structural changes in time series.
//!
//! # Available Algorithms
//!
//! - **PELT**: Pruned Exact Linear Time - exact method with O(n) average complexity
//!
//! # Cost Functions
//!
//! - **L1**: Robust to outliers, uses median
//! - **L2**: Standard mean-based (default)
//! - **Normal**: Log-likelihood for variance changes
//! - **Poisson**: For count data
//! - **LinearTrend**: Detects slope/trend changes
//! - **MeanVariance**: Joint mean and variance changes
//! - **Cusum**: Cumulative sum for sustained shifts
//!
//! # Example
//!
//! ```
//! use anofox_forecast::changepoint::{pelt_detect, PeltConfig, CostFunction};
//!
//! // Create series with a level shift
//! let mut series = vec![0.0; 50];
//! series.extend(vec![10.0; 50]);
//!
//! let config = PeltConfig::default().penalty(5.0);
//! let result = pelt_detect(&series, &config);
//!
//! // Should detect one changepoint around index 50
//! assert_eq!(result.n_changepoints, 1);
//!
//! // Use LinearTrend cost for slope changes
//! let config = PeltConfig::default()
//! .cost_function(CostFunction::LinearTrend)
//! .penalty(10.0);
//! ```
pub use ;
pub use ;