Changepoint detection with Pruned Exact Linear Time.
Usage
Python
from pelt import predict
predict(signal, penalty=20, segment_cost_function="l1", jump=10, minimum_segment_length=2)
Rust
use std::num::NonZero;
use pelt::{Pelt, SegmentCostFunction};
// Setup the structure for calculating changepoints
let pelt = Pelt::new()
.with_jump(NonZero::new(5).expect("Invalid number"))
.with_minimum_segment_length(NonZero::new(2).expect("Invalid number"))
.with_segment_cost_function(SegmentCostFunction::L1);
// Do the calculation on a data set
let penalty = 10.0;
let result = pelt.predict(&signal[..], penalty)?;
Run locally
# Install maturin inside a Python environment
python3 -m venv .env
source .env/bin/activate
pip install maturin numpy
# Create a Python package from the Rust code
maturin develop
# Open an interpreter
python
>>> from pelt import predict
>>> import numpy as np
>>> signal = np.array([np.sin(np.arange(0, 1000, 10))]).transpose()
>>> predict(signal, penalty=20)
Benchmarks
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 |
Command
maturin develop
python benches/bench_compare.py
Profile
Command
cargo build --example simple --profile profiling \
&& samply record target/profiling/examples/simple tests/signals-large.csv
Credits
Metadata
Release files for pelt 0.3.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 1.9 MB
Release files / pelt-0.3.4-cp311-abi3-win_arm64.whl
| Download URL | pelt-0.3.4-cp311-abi3-win_arm64.whl |
|---|---|
| Size | 162.4 kB |
| Tags | CPython 3.11 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
f12fd6631e99aaedcbd99fb002f2c16a6cadb6bc89b56c4407158cd02f915577
|
|
BLAKE2b-256 checksum How to use checksums |
94e64bcaf3841f7eab1818f1c547abb24bd45443a80ebe21b4488645cd385e4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / pelt-0.3.4-cp311-abi3-win_amd64.whl
| Download URL | pelt-0.3.4-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 168.6 kB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
5d70bd1f2d9688307c19e1905e0f73980150857836b339acb658ed8f754ecd90
|
|
BLAKE2b-256 checksum How to use checksums |
00d4de6514e8b10d337d63b92b6cab35ddcd018f9802258722d386278f74a3f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / pelt-0.3.4-cp311-abi3-manylinux_2_34_x86_64.whl
| Download URL | pelt-0.3.4-cp311-abi3-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 273.2 kB |
| Tags | CPython 3.11 Linux glibc 2.34+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
762f60aee6ab1b2f3eb76f50e63c5fb97e307bc64929f9fd4e6471a01de8b56e
|
|
BLAKE2b-256 checksum How to use checksums |
a4ca4ed55f3a639c975772481a6e9877eb8ead389fbc922c5d7d3ed1da1e1ae1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / pelt-0.3.4-cp311-abi3-manylinux_2_31_riscv64.whl
| Download URL | pelt-0.3.4-cp311-abi3-manylinux_2_31_riscv64.whl |
|---|---|
| Size | 278.5 kB |
| Tags | CPython 3.11 Linux glibc 2.31+ RISC-V 64 abi3 |
|
SHA-256 checksum How to use checksums |
690811f5d57c564c2326a4bbcb56b4e7a888668e00037943e9ff4cd040a032f6
|
|
BLAKE2b-256 checksum How to use checksums |
4d8d06c73239ec5c0ee5acc7b20d913cafe2517b8daaf09c7c28dd8fb58a4079
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / pelt-0.3.4-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
| Download URL | pelt-0.3.4-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl |
|---|---|
| Size | 271.3 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARMv7l abi3 |
|
SHA-256 checksum How to use checksums |
a5bdf0fd4a5e3c8948154e9898a41abf36f1a20044ddb01660179a6b7ee5ee5d
|
|
BLAKE2b-256 checksum How to use checksums |
35ec9b26a571f918489132bbd93200a6cab455a809adc2e4672a87d5907e4634
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / pelt-0.3.4-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | pelt-0.3.4-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 262.2 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
fdfe2f33abc55a381550ed0382fa22566c86333aaa9d490ed9673205e11d5ef2
|
|
BLAKE2b-256 checksum How to use checksums |
77c2e5a7c0f3f7cdc8d9de8eafcadff191511e05e863009b5e9a10c9ac7e6b8e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / pelt-0.3.4-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | pelt-0.3.4-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 237.1 kB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
7f3aa72d903a5a3f565f13a419342918376ce765af46d0dd5a3e45278e02221d
|
|
BLAKE2b-256 checksum How to use checksums |
d2160b2dc98425fc629510766ea6de9bc404e34247e5af5d6c0a2321c56088af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / pelt-0.3.4-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | pelt-0.3.4-cp311-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 250.2 kB |
| Tags | CPython 3.11 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
6461e31d716d39792c96447429f89116cfdade7513555d592160aa9298037783
|
|
BLAKE2b-256 checksum How to use checksums |
8d14f9b0625dbda9383efe34ded06f5e74c664f87dabad6c279029ef86e5f7c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Security for pelt 0.3.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.