Skip to main content

Crates.io pypi MPL-2.0 docs.rs ci

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

[!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
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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pelt-0.3.3-cp311-abi3-win_arm64.whl (162.1 kB view details)

Uploaded CPython 3.11+Windows ARM64

pelt-0.3.3-cp311-abi3-win_amd64.whl (167.9 kB view details)

Uploaded CPython 3.11+Windows x86-64

pelt-0.3.3-cp311-abi3-manylinux_2_34_x86_64.whl (273.3 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.34+ x86-64

pelt-0.3.3-cp311-abi3-manylinux_2_31_riscv64.whl (278.5 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.31+ riscv64

pelt-0.3.3-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (271.5 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARMv7l

pelt-0.3.3-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (262.3 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

pelt-0.3.3-cp311-abi3-macosx_11_0_arm64.whl (238.1 kB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

pelt-0.3.3-cp311-abi3-macosx_10_12_x86_64.whl (250.4 kB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

Details for the file pelt-0.3.3-cp311-abi3-win_arm64.whl.

File metadata

  • Download URL: pelt-0.3.3-cp311-abi3-win_arm64.whl
  • Upload date:
  • Size: 162.1 kB
  • Tags: CPython 3.11+, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for pelt-0.3.3-cp311-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 baf80749c57cc44a4b3d62cc7d462f6ede1fb333254c3a1e999494c1eaa2f689
MD5 a342a876a2c9f74f824e5c7b5f669623
BLAKE2b-256 bf8509ce221b07f0c56a28892eab9ecee724dac18250f19288aa235479c6b2b0

See more details on using hashes here.

File details

Details for the file pelt-0.3.3-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: pelt-0.3.3-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 167.9 kB
  • Tags: CPython 3.11+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for pelt-0.3.3-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 0802b8a9016f3f4c67c254b697c492dea3c0f69122476d77d89d51067490ce74
MD5 63414b66180c59548b5164eac986ff11
BLAKE2b-256 a4a2e6a251b7d0b758f4094688690e201e3506314f805254bfdbfa8289a594f2

See more details on using hashes here.

File details

Details for the file pelt-0.3.3-cp311-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pelt-0.3.3-cp311-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 a04508d8e8473349ac2bb7ada4c4c43b1f9092475fcceb597363c2261b653a0d
MD5 b688e57219b6b8707aa4cf40470b32e0
BLAKE2b-256 c045559777a3528c55a8759d34d4f145ce0addb6c1d4e9adf40ee43699a3be76

See more details on using hashes here.

File details

Details for the file pelt-0.3.3-cp311-abi3-manylinux_2_31_riscv64.whl.

File metadata

File hashes

Hashes for pelt-0.3.3-cp311-abi3-manylinux_2_31_riscv64.whl
Algorithm Hash digest
SHA256 af250edb99bb775d40718937ba54fe2a5fa0d3f8207cd0ad69dda593d5079b44
MD5 bf5c598a16302f3eeda2f829533c5eea
BLAKE2b-256 2b2ebdf5c1e591337b4a5677f02c6de6501dc9fcc2e08fa0f94b80204ffe6f73

See more details on using hashes here.

File details

Details for the file pelt-0.3.3-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for pelt-0.3.3-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 e8b2a934c8eee4c62a25641de522d6a1d629c43aa99efed8c0728d02599a83b6
MD5 f655e1d0a929ef914ad3d4284a467840
BLAKE2b-256 75355744fecb723390bf6848930cb40fd00c4cf9697823d4a314c684b05d2d7b

See more details on using hashes here.

File details

Details for the file pelt-0.3.3-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pelt-0.3.3-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bdf906e107b656a2b192f033a804ce1d68b413cc1a18385c53270f54de9c5ea8
MD5 408fb0b6eb0b6f14248337426584ddff
BLAKE2b-256 f06c82a530624d91e94d8af412d871986417993ea9749553d2fa853a218c2bb7

See more details on using hashes here.

File details

Details for the file pelt-0.3.3-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pelt-0.3.3-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 62fa20bf53f89450b9f4728bae63eebf342040e74e6d8011b4d57d17efd802df
MD5 049e120038e5d58dbe44de6c1a502f60
BLAKE2b-256 de6f3f938b8214eeaa7683eb8c745b79af045889e92c51083badfb239c1941e6

See more details on using hashes here.

File details

Details for the file pelt-0.3.3-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pelt-0.3.3-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4ed01542ba87de15aaeed889ba28d6d43fef86b2c1eef992d96b444004028c5e
MD5 beb06fb39e412d74c7e7a1e1fdf1a4ac
BLAKE2b-256 e8bf0c0b699f3f4cad1523ac0c666078bfd9c1d02453d572afe52dd970383b00

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.4

8 files

This release

0.3.3 This release

8 files

0.3.2

5 files

0.3.1

4 files

0.3.0

4 files

0.2.0

4 files

0.1.0

4 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page