https://github.com/armavica/particles

Sequential Monte Carlo in python

https://github.com/armavica/particles

Science Score: 10.0%

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

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: springer.com
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.4%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Sequential Monte Carlo in python

Basic Info
  • Host: GitHub
  • Owner: Armavica
  • License: mit
  • Default Branch: master
  • Size: 5.25 MB
Statistics
  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Fork of nchopin/particles
Created almost 3 years ago · Last pushed almost 3 years ago
Metadata Files
Readme Changelog Contributing License

README.md

particles

Sequential Monte Carlo in python.

Motivation

This package was developed to complement the following book:

An introduction to Sequential Monte Carlo

by Nicolas Chopin and Omiros Papaspiliopoulos.

Features

  • particle filtering: bootstrap filter, guided filter, APF.

  • resampling: multinomial, residual, stratified, systematic and SSP.

  • possibility to define state-space models using some (basic) form of probabilistic programming; see below for an example.

  • SQMC (Sequential quasi Monte Carlo); routines for computing the Hilbert curve, and generating RQMC sequences.

  • FFBS (forward filtering backward sampling): standard, O(N^2) variant, and faster variants based on either MCMC, pure rejection, or the hybrid scheme ; see Dau & Chopin (2022) for a discussion. The QMC version of Gerber and Chopin (2017, Bernoulli) is also implemented.

  • other smoothing algorithms: fixed-lag smoothing, on-line smoothing, two-filter smoothing (O(N) and O(N^2) variants).

  • Exact filtering/smoothing algorithms: Kalman (for linear Gaussian models) and forward-backward recursions (for finite hidden Markov models).

  • Standard and waste-free SMC samplers: SMC tempering, IBIS (a.k.a. data tempering). SMC samplers for binary words (Schäfer and Chopin, 2014), with application to variable selection.

  • Bayesian parameter inference for state-space models: PMCMC (PMMH, Particle Gibbs) and SMC^2.

  • Basic support for parallel computation (i.e. running multiple SMC algorithms on different CPU cores).

  • Variance estimators (Chan and Lai, 2013 ; Lee and Whiteley, 2018; Olsson and Douc, 2019)

  • nested sampling (basic, experimental).

Example

Here is how you may define a parametric state-space model:

```python import particles import particles.statespacemodels as ssm import particles.distributions as dists

class ToySSM(ssm.StateSpaceModel): def PX0(self): # Distribution of X0 return dists.Normal() # X0 ~ N(0, 1) def PX(self, t, xp): # Distribution of Xt given X{t-1} return dists.Normal(loc=xp) # Xt ~ N( X{t-1}, 1) def PY(self, t, xp, x): # Distribution of Yt given Xt (and X{t-1}) return dists.Normal(loc=x, scale=self.sigma) # Yt ~ N(X_t, sigma^2) ```

You may now choose a particular model within this class, and simulate data from it:

python my_model = ToySSM(sigma=0.2) x, y = my_model.simulate(200) # sample size is 200

To run a bootstrap particle filter for this model and data y, simply do:

python alg = particles.SMC(fk=ssm.Bootstrap(ssm=my_model, data=y), N=200) alg.run()

That's it! Head to the documentation for more examples, explanations, and installation instructions.

Who do I talk to?

Nicolas Chopin (nicolas.chopin@ensae.fr) is the main author, contributor, and person to blame if things do not work as expected.

Bug reports, feature requests, questions, rants, etc are welcome, preferably on the github page.

Owner

  • Name: Virgile Andreani
  • Login: Armavica
  • Kind: user
  • Location: Boston

Hi! I am a physicist by training with a PhD in computational biology. I love Rust, Monte-Carlo methods and scientific computing.

GitHub Events

Total
Last Year

Dependencies

docs/source/requirements.txt pypi
  • ipython *
  • joblib *
  • matplotlib *
  • nbsphinx *
  • numba *
  • numpy ==1.23
  • scikit-learn *
  • scipy *
  • seaborn *
  • setuptools *
requirements.txt pypi
  • ipython *
  • joblib *
  • matplotlib *
  • nbsphinx *
  • numba *
  • numpy *
  • scikit-learn *
  • scipy *
  • seaborn *
  • setuptools *
setup.py pypi
  • joblib *
  • numba *
  • numpy >=1.18
  • scipy >=1.7