All Projects → tingiskhan → pyfilter

tingiskhan / pyfilter

Licence: MIT License
Particle filtering and sequential parameter inference in Python

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to pyfilter

pomp
R package for statistical inference using partially observed Markov processes
Stars: ✭ 88 (+69.23%)
Mutual labels:  time-series, particle-filter, sequential-monte-carlo
SMC.jl
Sequential Monte Carlo algorithm for approximation of posterior distributions.
Stars: ✭ 53 (+1.92%)
Mutual labels:  time-series, bayesian-inference, sequential-monte-carlo
Exoplanet
Fast & scalable MCMC for all your exoplanet needs!
Stars: ✭ 122 (+134.62%)
Mutual labels:  time-series, bayesian-inference
BayesHMM
Full Bayesian Inference for Hidden Markov Models
Stars: ✭ 35 (-32.69%)
Mutual labels:  time-series, bayesian-inference
Survival Analysis Using Deep Learning
This repository contains morden baysian statistics and deep learning based research articles , software for survival analysis
Stars: ✭ 139 (+167.31%)
Mutual labels:  time-series, bayesian-inference
Birch
A probabilistic programming language that combines automatic differentiation, automatic marginalization, and automatic conditioning within Monte Carlo methods.
Stars: ✭ 80 (+53.85%)
Mutual labels:  bayesian-inference, sequential-monte-carlo
models
Forecasting 🇫🇷 elections with Bayesian statistics 🥳
Stars: ✭ 24 (-53.85%)
Mutual labels:  time-series, bayesian-inference
SAnD
[Implementation example] Attend and Diagnose: Clinical Time Series Analysis Using Attention Models
Stars: ✭ 39 (-25%)
Mutual labels:  time-series
Hurst-exponent-R-S-analysis-
Calculates the Hurst exponent of a time series based on Rescaled range (R/S) analysis.
Stars: ✭ 33 (-36.54%)
Mutual labels:  time-series
questdb.io
The official QuestDB website, database documentation and blog.
Stars: ✭ 75 (+44.23%)
Mutual labels:  time-series
SLAM AND PATH PLANNING ALGORITHMS
This repository contains the solutions to all the exercises for the MOOC about SLAM and PATH-PLANNING algorithms given by professor Claus Brenner at Leibniz University. This repository also contains my personal notes, most of them in PDF format, and many vector graphics created by myself to illustrate the theoretical concepts. Hope you enjoy it! :)
Stars: ✭ 107 (+105.77%)
Mutual labels:  particle-filter
COVID19
Using Kalman Filter to Predict Corona Virus Spread
Stars: ✭ 78 (+50%)
Mutual labels:  time-series
TuringBnpBenchmarks
Benchmarks of Bayesian Nonparametric models in Turing and other PPLs
Stars: ✭ 24 (-53.85%)
Mutual labels:  bayesian-inference
barrage
Barrage is an opinionated supervised deep learning tool built on top of TensorFlow 2.x designed to standardize and orchestrate the training and scoring of complicated models.
Stars: ✭ 16 (-69.23%)
Mutual labels:  time-series
brmstools
Helper functions for brmsfit objects (DEPRECATED)
Stars: ✭ 24 (-53.85%)
Mutual labels:  bayesian-inference
Time-Series-Transformer
A data preprocessing package for time series data. Design for machine learning and deep learning.
Stars: ✭ 123 (+136.54%)
Mutual labels:  time-series
FBNN
Code for "Functional variational Bayesian neural networks" (https://arxiv.org/abs/1903.05779)
Stars: ✭ 67 (+28.85%)
Mutual labels:  bayesian-inference
bayes-filters-lib
A flexible, modern, C++ recursive Bayesian estimation library.
Stars: ✭ 48 (-7.69%)
Mutual labels:  particle-filter
HistoricalVolatility
A framework for historical volatility estimation and analysis.
Stars: ✭ 22 (-57.69%)
Mutual labels:  time-series
Chronetic
Analyzes chronological patterns present in time-series data and provides human-readable descriptions
Stars: ✭ 23 (-55.77%)
Mutual labels:  time-series

pyfilter

pyfilter is a package designed for joint parameter and state inference in (mainly) non-linear state space models using Sequential Monte Carlo and variational inference. It is similar to pomp, but implemented in Python leveraging pytorch. The interface is heavily inspired by pymc3.

Example

from pyfilter.timeseries import AffineEulerMaruyama, LinearGaussianObservations
import torch
from pyfilter.distributions import DistributionWrapper
from torch.distributions import Normal
import matplotlib.pyplot as plt
from pyfilter.filters.particle import APF, proposals as p
from math import sqrt


def drift(x, gamma, sigma):
    return torch.sin(x.values - gamma)


def diffusion(x, gamma, sigma):
    return sigma


dt = 0.1
parameters = 0.0, 1.0
init_dist = DistributionWrapper(Normal, loc=0.0, scale=1.0)
inc_dist = DistributionWrapper(Normal, loc=0.0, scale=sqrt(dt))

sine_diffusion = AffineEulerMaruyama(
    (drift, diffusion),
    parameters,
    init_dist,
    inc_dist,
    dt=dt,
    num_steps=int(1 / dt)
)
ssm = LinearGaussianObservations(sine_diffusion, scale=0.1)

x, y = ssm.sample_path(1000)

fig, ax = plt.subplots(2)
ax[0].plot(x.numpy(), label="True")
ax[1].plot(y.numpy())

filt = APF(ssm, 1000, proposal=p.Bootstrap())
result = filt.longfilter(y)

ax[0].plot(result.filter_means.numpy(), label="Filtered")
ax[0].legend()

plt.show()

Installation

Install the package by typing the following in a git shell or similar

pip install git+https://github.com/tingiskhan/pyfilter.git

Implementations

Below is a list of implemented algorithms/filters.

Filters

The currently implemented filters are

  1. SISR
  2. APF
  3. UKF

For filters 1. and 2. there exist different proposals, s.a.

  1. Optimal proposal when observations are linear combinations of states, and normally distributed.
  2. Locally linearized observation density, mainly used for models having log-concave observation density.

Algorithms

The currently implemented algorithms are

  1. NESS
  2. SMC2 (see here for one of the original authors' implementation)
  3. Variational Bayes
  4. SMC2FW
  5. PMMH

Caveats

Please note that this is a project I work on in my spare time, as such there might be errors in the implementations and sub-optimal performance. You are more than welcome to report bugs should you try out the library.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].