Skip to main content

Changepoint detection with Pruned Exact Linear Time

Project description

Crates.io MPL-2.0 docs.rs ci pypi

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, keep_initial_zero=False)

Rust

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 --features python

# 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)

Credits

Project details


Download files

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

Source Distribution

pelt-0.1.0.tar.gz (66.8 kB view details)

Uploaded Source

Built Distributions

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

pelt-0.1.0-cp314-cp314-macosx_11_0_arm64.whl (206.0 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

pelt-0.1.0-cp39-cp39-win_amd64.whl (130.5 kB view details)

Uploaded CPython 3.9Windows x86-64

pelt-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (232.7 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

Details for the file pelt-0.1.0.tar.gz.

File metadata

  • Download URL: pelt-0.1.0.tar.gz
  • Upload date:
  • Size: 66.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.10.2

File hashes

Hashes for pelt-0.1.0.tar.gz
Algorithm Hash digest
SHA256 381680546ad790df8e5c69b27bb6e52cd44ce76b541494356d22f9b9733eada1
MD5 53370a7eb8f4bcb5a2afbdb3ed689c45
BLAKE2b-256 81818d27d019f624098eda7d1bfe4ea8a8d9af56f86ba9a61be500a190932047

See more details on using hashes here.

File details

Details for the file pelt-0.1.0-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pelt-0.1.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6d05e024387ecb34cd9ce470016d9d9a79c904ca9f75a123cc4b87c7e04309b7
MD5 7b6f37c33be6c17f3730fe57a3abee90
BLAKE2b-256 eb3efcfa3f7122d554f07524a44d62f87e12133c79920d45e1f1259846df3656

See more details on using hashes here.

File details

Details for the file pelt-0.1.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pelt-0.1.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 130.5 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.10.2

File hashes

Hashes for pelt-0.1.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 2e71356a8533efa0e2202a3986218f0eb749cf2b97ed96f0aacd2dd5f81f3764
MD5 3520464bcc47baafe95ef02d5e24f1be
BLAKE2b-256 511f212b8ab332ad976984f2526df8aa194d83d6ca72ad71191134f545342f16

See more details on using hashes here.

File details

Details for the file pelt-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pelt-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c3ae105018aaec1b7305b8efd2f532bd25b13f0365599aaf2eb2a1464e0f426c
MD5 d9dd8605f0a73d5b3a5fc7ed823e7505
BLAKE2b-256 cf96dbf5e569685e70dde2a89db9b6e7bb0f2b6ba8d962903fd6731be0381081

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page