changepoint

A toolkit for Bayesian change point detection

https://github.com/promised-ai/changepoint

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.1%) to scientific vocabulary

Keywords

bayesian changepoint-detection rust
Last synced: 6 months ago · JSON representation

Repository

A toolkit for Bayesian change point detection

Basic Info
  • Host: GitHub
  • Owner: promised-ai
  • License: mit
  • Language: Jupyter Notebook
  • Default Branch: master
  • Homepage:
  • Size: 6.17 MB
Statistics
  • Stars: 31
  • Watchers: 6
  • Forks: 2
  • Open Issues: 2
  • Releases: 6
Topics
bayesian changepoint-detection rust
Created almost 3 years ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog License

README.md

changepoint - Change point detection for Rust

Changepoint is a library for doing change point detection for streams of data.

Crates.io docs.rs

See this for more info on the Python bindings.

Algorithms

Includes the following change point detection algorithms: * Bocpd -- Online Bayesian Change Point Detection Reference. * BocpdTruncated -- Same as Bocpd but truncated the run-length distribution when those lengths are unlikely. * Argpcp -- Gaussian Process Change Point detector Reference

Example

``rust //! A demo of the online Bayesian change point detection on //! the 3-month Treasury Bill Secondary Market Rate from //! //! After this example is run, the filetrasury_bill.ipynb` can be run to generate //! plots for this dataset. //! //! > Board of Governors of the Federal Reserve System (US), 3-Month Treasury Bill: Secondary //! > Market Rate [TB3MS], retrieved from FRED, Federal Reserve Bank of St. Louis; //! > https://fred.stlouisfed.org/series/TB3MS, August 5, 2019.

use changepoint::{utils::, BocpdTruncated, BocpdLike}; use rv::prelude::; use std::io; use std::path::PathBuf; use std::fs::readtostring;

fn main() -> io::Result<()> { // Parse the data from the TB3MS dataset let mut csvpath = PathBuf::from(env!("CARGOMANIFESTDIR")); csvpath.push("resources/TB3MS.csv"); let data: String = readtostring(&csvpath)?; let (dates, pctchange): (Vec<&str>, Vec) = data .lines() .skip(1) .map(|line| { let split: Vec<&str> = line.splitn(2, ',').collect(); let date = split[0]; let rawpct = split[1]; (date, rawpct.parse::().unwrap()) }) .unzip();

// Create the Bocpd processor
let mut cpd = BocpdTruncated::new(
    250.0,
    NormalGamma::new_unchecked(0.0, 1.0, 1.0, 1.0),
);

// Feed data into change point detector and generate a sequence of run-length distributions
let rs: Vec<Vec<f64>> = pct_change
    .iter()
    .map(|d| cpd.step(d).into())
    .collect();

// Determine most likely change points
let change_points: Vec<usize> = map_changepoints(&rs);
let change_dates: Vec<&str> =
    change_points.iter().map(|&i| dates[i]).collect();

// Write output for processing my `trasury_bill.ipynb`.
write_data_and_r(
    "treasury_bill_output",
    &pct_change,
    &rs,
    &change_points,
)?;

println!("Most likely dates of changes = {:#?}", change_dates);

Ok(())

} ```

To run this example, from the source root, run cargo run --example treasury_bill. The partner notebook can be used to generate the following plots:

Treasury Bill Plots

Owner

  • Name: promised-ai
  • Login: promised-ai
  • Kind: organization

GitHub Events

Total
  • Watch event: 12
  • Pull request review event: 1
  • Pull request event: 2
  • Fork event: 1
Last Year
  • Watch event: 12
  • Pull request review event: 1
  • Pull request event: 2
  • Fork event: 1

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 80
  • Total Committers: 5
  • Avg Commits per committer: 16.0
  • Development Distribution Score (DDS): 0.262
Past Year
  • Commits: 2
  • Committers: 2
  • Avg Commits per committer: 1.0
  • Development Distribution Score (DDS): 0.5
Top Committers
Name Email Commits
Mike Schmidt s****t@g****m 59
Baxter Eaves b****r@g****m 11
Baxter Eaves b****x@r****i 8
Ben Sully b****8@g****m 1
Jose Storopoli t****i@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 1
  • Total pull requests: 11
  • Average time to close issues: 15 days
  • Average time to close pull requests: 12 days
  • Total issue authors: 1
  • Total pull request authors: 3
  • Average comments per issue: 2.0
  • Average comments per pull request: 0.45
  • Merged pull requests: 9
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 3
  • Average time to close issues: N/A
  • Average time to close pull requests: 24 minutes
  • Issue authors: 0
  • Pull request authors: 2
  • Average comments per issue: 0
  • Average comments per pull request: 0.33
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • HilaManor (1)
Pull Request Authors
  • schmidmt (9)
  • ebw44 (4)
  • sd2k (2)
Top Labels
Issue Labels
bug (1)
Pull Request Labels
bug (1) enhancement (1)

Packages

  • Total packages: 2
  • Total downloads:
    • cargo 53,864 total
    • pypi 1,603 last-month
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 4
    (may contain duplicates)
  • Total versions: 30
  • Total maintainers: 5
pypi.org: changepoint

A Bayesian change point library

  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 4
  • Downloads: 1,603 Last month
Rankings
Dependent repos count: 7.5%
Downloads: 9.7%
Dependent packages count: 10.1%
Average: 15.3%
Stargazers count: 19.4%
Forks count: 29.8%
Maintainers (3)
Last synced: 6 months ago
crates.io: changepoint

Change Point Detection in Rust

  • Versions: 24
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 53,864 Total
Rankings
Downloads: 19.6%
Dependent repos count: 29.3%
Average: 32.8%
Dependent packages count: 33.8%
Forks count: 37.5%
Stargazers count: 43.6%
Maintainers (2)
Last synced: 6 months ago

Dependencies

.github/workflows/python-build-test.yaml actions
  • PyO3/maturin-action v1 composite
  • Swatinem/rust-cache v2 composite
  • actions/checkout v3 composite
  • actions/download-artifact v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
  • dtolnay/rust-toolchain stable composite
.github/workflows/rust-build-test.yaml actions
  • Swatinem/rust-cache v2 composite
  • actions/checkout v3 composite
  • dtolnay/rust-toolchain stable composite
changepoint/Cargo.toml cargo
  • assert 0.7 development
  • criterion 0.5 development
  • serde_json 1 development
  • approx 0.5
  • derive_more 0.99
  • nalgebra 0.32
  • ndarray 0.15
  • num-traits 0.2
  • rand 0.8
  • rayon 1.4
  • rv 0.16
  • serde 1
  • serde_derive 1
  • special 0.10
pychangepoint/Cargo.toml cargo
pychangepoint/pyproject.toml pypi
pychangepoint/requirements-dev.txt pypi
  • hypothesis ==6.65.2 development
  • maturin ==0.14.10 development
  • pytest ==7.2.0 development
  • pytest-cov ==4.0.0 development
  • pytest-xdist ==3.1.0 development
pychangepoint/requirements-docs.txt pypi
  • autodocsumm ==0.2.10
  • commonmark ==0.9.1
  • hypothesis ==6.75.1
  • livereload ==2.6.3
  • numpy *
  • numpydoc ==1.5.0
  • pandas *
  • pyarrow *
  • pydata-sphinx-theme ==0.13.3
  • sphinx ==6.2.1
  • sphinx-autosummary-accessors ==2023.4.0
  • sphinx-copybutton ==0.5.1
  • sphinx-design ==0.4.1
  • sphinx-favicon ==1.0.1
  • sphinx-rtd-theme ==1.2.2
  • sphinxcontrib-applehelp ==1.0.4
  • sphinxcontrib-devhelp ==1.0.2
  • sphinxcontrib-htmlhelp ==2.0.1
  • sphinxcontrib-jsmath ==1.0.1
  • sphinxcontrib-napoleon ==0.7
  • sphinxcontrib-qthelp ==1.0.3
  • sphinxcontrib-serializinghtml ==1.1.5
pychangepoint/requirements-lint.txt pypi
  • black ==23.1.0
  • blackdoc ==0.3.7
  • mypy ==1.0.0
  • ruff ==0.0.247
pychangepoint/setup.py pypi