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.4-cp311-abi3-win_arm64.whl (162.4 kB view details)

Uploaded CPython 3.11+Windows ARM64

pelt-0.3.4-cp311-abi3-win_amd64.whl (168.6 kB view details)

Uploaded CPython 3.11+Windows x86-64

pelt-0.3.4-cp311-abi3-manylinux_2_34_x86_64.whl (273.2 kB view details)

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

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

Uploaded CPython 3.11+manylinux: glibc 2.31+ riscv64

pelt-0.3.4-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (271.3 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARMv7l

pelt-0.3.4-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (262.2 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

pelt-0.3.4-cp311-abi3-macosx_11_0_arm64.whl (237.1 kB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

pelt-0.3.4-cp311-abi3-macosx_10_12_x86_64.whl (250.2 kB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: pelt-0.3.4-cp311-abi3-win_arm64.whl
  • Upload date:
  • Size: 162.4 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.4-cp311-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 f12fd6631e99aaedcbd99fb002f2c16a6cadb6bc89b56c4407158cd02f915577
MD5 8f72b1e25aefc777ecfaab5529b7cdb4
BLAKE2b-256 94e64bcaf3841f7eab1818f1c547abb24bd45443a80ebe21b4488645cd385e4c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pelt-0.3.4-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 168.6 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.4-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 5d70bd1f2d9688307c19e1905e0f73980150857836b339acb658ed8f754ecd90
MD5 c66038cc65339142a941707106f24de5
BLAKE2b-256 00d4de6514e8b10d337d63b92b6cab35ddcd018f9802258722d386278f74a3f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pelt-0.3.4-cp311-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 762f60aee6ab1b2f3eb76f50e63c5fb97e307bc64929f9fd4e6471a01de8b56e
MD5 9c9cf0c9610fbc975c3387e7cb1f7e72
BLAKE2b-256 a4ca4ed55f3a639c975772481a6e9877eb8ead389fbc922c5d7d3ed1da1e1ae1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pelt-0.3.4-cp311-abi3-manylinux_2_31_riscv64.whl
Algorithm Hash digest
SHA256 690811f5d57c564c2326a4bbcb56b4e7a888668e00037943e9ff4cd040a032f6
MD5 ee0e0412d656e6e98298095a6875977d
BLAKE2b-256 4d8d06c73239ec5c0ee5acc7b20d913cafe2517b8daaf09c7c28dd8fb58a4079

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pelt-0.3.4-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 a5bdf0fd4a5e3c8948154e9898a41abf36f1a20044ddb01660179a6b7ee5ee5d
MD5 2d8d555f2e2c378f842fc2bdf6f37ea0
BLAKE2b-256 35ec9b26a571f918489132bbd93200a6cab455a809adc2e4672a87d5907e4634

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pelt-0.3.4-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fdfe2f33abc55a381550ed0382fa22566c86333aaa9d490ed9673205e11d5ef2
MD5 00f072e92e29c8c6d2d7f2587fd1f9af
BLAKE2b-256 77c2e5a7c0f3f7cdc8d9de8eafcadff191511e05e863009b5e9a10c9ac7e6b8e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pelt-0.3.4-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7f3aa72d903a5a3f565f13a419342918376ce765af46d0dd5a3e45278e02221d
MD5 ad03ca9da97c9e0459ab1d93f44708c3
BLAKE2b-256 d2160b2dc98425fc629510766ea6de9bc404e34247e5af5d6c0a2321c56088af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pelt-0.3.4-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6461e31d716d39792c96447429f89116cfdade7513555d592160aa9298037783
MD5 981be90049241155f59c38c7cc2ff8d1
BLAKE2b-256 8d14f9b0625dbda9383efe34ded06f5e74c664f87dabad6c279029ef86e5f7c5

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.4 This release

8 files

0.3.3

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