| Name | particles JSON |
| Version |
0.4
JSON |
| download |
| home_page | |
| Summary | Sequential Monte Carlo in Python |
| upload_time | 2023-11-06 16:26:35 |
| maintainer | |
| docs_url | None |
| author | |
| requires_python | >=3.9 |
| license | MIT License |
| keywords |
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|

# particles #
Sequential Monte Carlo in python.
## Motivation ##
This package was developed to complement the following book:
[An introduction to Sequential Monte Carlo](https://www.springer.com/gp/book/9783030478445)
by Nicolas Chopin and Omiros Papaspiliopoulos.
It now also implements algorithms and methods introduced after the book was
published, see below.
## 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**: both the vanilla version and the SMC sampler of Salomone
et al (2018).
## Example ##
Here is how you may define a parametric state-space model:
```python
import particles
import particles.state_space_models as ssm
import particles.distributions as dists
class ToySSM(ssm.StateSpaceModel):
def PX0(self): # Distribution of X_0
return dists.Normal() # X_0 ~ N(0, 1)
def PX(self, t, xp): # Distribution of X_t given X_{t-1}
return dists.Normal(loc=xp) # X_t ~ N( X_{t-1}, 1)
def PY(self, t, xp, x): # Distribution of Y_t given X_t (and X_{t-1})
return dists.Normal(loc=x, scale=self.sigma) # Y_t ~ 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](https://particles-sequential-monte-carlo-in-python.readthedocs.io/en/latest/)
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.
Raw data
{
"_id": null,
"home_page": "",
"name": "particles",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "",
"keywords": "",
"author": "",
"author_email": "Nicolas Chopin <nicolas.chopin@ensae.fr>",
"download_url": "",
"platform": null,
"description": "\n\n# particles #\n\nSequential Monte Carlo in python. \n\n## Motivation ##\n\nThis package was developed to complement the following book:\n\n[An introduction to Sequential Monte Carlo](https://www.springer.com/gp/book/9783030478445)\n\nby Nicolas Chopin and Omiros Papaspiliopoulos. \n\nIt now also implements algorithms and methods introduced after the book was\npublished, see below. \n\n## Features ##\n\n* **particle filtering**: bootstrap filter, guided filter, APF.\n\n* **resampling**: multinomial, residual, stratified, systematic and SSP. \n\n* possibility to define **state-space models** using some (basic) form of \n probabilistic programming; see below for an example. \n\n* **SQMC** (Sequential quasi Monte Carlo); routines for computing the Hilbert curve, \n and generating RQMC sequences. \n\n* **FFBS (forward filtering backward sampling)**: standard, O(N^2) variant, and\n faster variants based on either MCMC, pure rejection, or the hybrid scheme;\n see Dau & Chopin (2022) for a discussion. The QMC version of Gerber and\n Chopin (2017, Bernoulli) is also implemented.\n\n* **other smoothing algorithms**: fixed-lag smoothing, on-line smoothing,\n two-filter smoothing (O(N) and O(N^2) variants). \n\n* Exact filtering/smoothing algorithms: **Kalman** (for linear Gaussian models) \n and **forward-backward recursions** (for finite hidden Markov models).\n\n* **Standard and waste-free SMC samplers**: SMC tempering, IBIS (a.k.a. data\n tempering). SMC samplers for binary words (Sch\u00e4fer and Chopin, 2014), with\n application to **variable selection**.\n\n* Bayesian parameter inference for state-space models: **PMCMC** (PMMH, Particle Gibbs) \n and **SMC^2**. \n\n* Basic support for **parallel computation** (i.e. running multiple SMC algorithms \n on different CPU cores). \n\n* **Variance estimators** (Chan and Lai, 2013 ; Lee and Whiteley, 2018; Olsson\n and Douc, 2019).\n\n* **nested sampling**: both the vanilla version and the SMC sampler of Salomone\n et al (2018).\n\n## Example ##\n\nHere is how you may define a parametric state-space model: \n\n```python\nimport particles\nimport particles.state_space_models as ssm\nimport particles.distributions as dists\n\nclass ToySSM(ssm.StateSpaceModel):\n def PX0(self): # Distribution of X_0 \n return dists.Normal() # X_0 ~ N(0, 1)\n def PX(self, t, xp): # Distribution of X_t given X_{t-1}\n return dists.Normal(loc=xp) # X_t ~ N( X_{t-1}, 1)\n def PY(self, t, xp, x): # Distribution of Y_t given X_t (and X_{t-1}) \n return dists.Normal(loc=x, scale=self.sigma) # Y_t ~ N(X_t, sigma^2)\n```\n\nYou may now choose a particular model within this class, and simulate data from it:\n\n```python\nmy_model = ToySSM(sigma=0.2)\nx, y = my_model.simulate(200) # sample size is 200\n```\n\nTo run a bootstrap particle filter for this model and data `y`, simply do:\n\n```python\nalg = particles.SMC(fk=ssm.Bootstrap(ssm=my_model, data=y), N=200)\nalg.run()\n```\n\nThat's it! Head to the\n[documentation](https://particles-sequential-monte-carlo-in-python.readthedocs.io/en/latest/) \nfor more examples, explanations, and installation instructions. \n\n## Who do I talk to? ##\n\nNicolas Chopin (nicolas.chopin@ensae.fr) is the main author, contributor, and \nperson to blame if things do not work as expected. \n\nBug reports, feature requests, questions, rants, etc are welcome, preferably \non the github page. \n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Sequential Monte Carlo in Python",
"version": "0.4",
"project_urls": {
"documentation": "https://particles-sequential-monte-carlo-in-python.readthedocs.io/en/latest/",
"repository": "https://github.com/nchopin/particles"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d54862d482f6c56fa68bcc67a7798a5ebdae6cc707002759148b2bd3e7e1d1f1",
"md5": "4036cfa56023eb0a281f6d83f67cea02",
"sha256": "c3ffb52fdd6945ba477bf2eb49ecd777a94ffd6547d8712b580f07419d083a3a"
},
"downloads": -1,
"filename": "particles-0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4036cfa56023eb0a281f6d83f67cea02",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 670482,
"upload_time": "2023-11-06T16:26:35",
"upload_time_iso_8601": "2023-11-06T16:26:35.459516Z",
"url": "https://files.pythonhosted.org/packages/d5/48/62d482f6c56fa68bcc67a7798a5ebdae6cc707002759148b2bd3e7e1d1f1/particles-0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-06 16:26:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "nchopin",
"github_project": "particles",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "particles"
}