Changepoint detection with Pruned Exact Linear Time.
Usage
Python
Rust
use NonZero;
use ;
// Setup the structure for calculating changepoints
let pelt = new
.with_jump
.with_minimum_segment_length
.with_segment_cost_function;
// Do the calculation on a data set
let penalty = 10.0;
let result = pelt.predict?;
Run locally
# Install maturin inside a Python environment
# Create a Python package from the Rust code
# Open an interpreter
>>> from
>>> import
>>> signal = )
Benchmarks
[!WARNING] Like all benchmarks, take these with a grain of salt.
Python
Comparison with ruptures:
| Cost Function | Data Points | Data Dimension | Mean pelt |
Mean ruptures |
Times Faster |
|---|---|---|---|---|---|
| L2 | 100 | 1D | 2.042 μs | 3.110 ms | 1523.1x |
| L2 | 100 | 2D | 2.420 μs | 3.148 ms | 1300.9x |
| L2 | 1000 | 1D | 106.783 μs | 190.108 ms | 1780.3x |
| L2 | 1000 | 2D | 55.815 μs | 104.357 ms | 1869.7x |
| L2 | 10000 | 1D | 20.407 ms | 12.859 s | 630.2x |
| L2 | 10000 | 2D | 2.317 ms | 1.797 s | 775.6x |
| L1 | 100 | 1D | 11.245 μs | 5.041 ms | 448.3x |
| L1 | 100 | 2D | 21.587 μs | 5.350 ms | 247.8x |
| L1 | 1000 | 1D | 321.619 μs | 187.656 ms | 583.5x |
| L1 | 1000 | 2D | 2.186 ms | 628.126 ms | 287.3x |
| L1 | 10000 | 1D | 13.215 ms | 15.615 s | 1181.6x |
| L1 | 10000 | 2D | 84.453 ms | 30.508 s | 361.2x |
Profile
&&