All work
Open Source · Ubunye AI Ecosystems

TFiltersPy: Kalman and particle filters for Python

You should not have to become a specialist to get a clean signal

Real sensors lie, and the mathematics that corrects them is well established but different for every method. TFiltersPy puts five Bayesian filters behind one familiar fit, predict and score interface, so choosing a method becomes a decision about the problem rather than a rewrite of everything around it.

What it is
Open source software
Role
Author and maintainer
Organisation
Ubunye AI Ecosystems
Period
2025 to present (repository created March 2025; version 1.0.6)
Status
Maintained
Licence
MIT
Package authors
Thabang L. Mashinini-Sekgoto, Lebogang L. Sekgoto, Palesa L. Sekgoto
Built with
Topics
  • Bayesian filtering
  • Kalman filtering
  • Particle filtering
  • Ensemble Kalman filter
  • State estimation
  • Time series
  • Open source software
  • Telematics
TFiltersPy: Kalman and particle filters for Python: You should not have to become a specialist to get a clean signal

The problem

Real sensors lie. GPS drifts, radar is noisy, vehicle trackers and IoT devices produce readings you cannot use directly, and you need an honest estimate of the state underneath the noise.

Why it mattered

Bayesian filtering solves this and the mathematics is well established, but re-deriving Kalman, Particle or Ensemble filters from papers on each new project is slow and error prone. The bigger problem was that existing implementations tended to assume a state-estimation background, so a practitioner who simply needed a clean signal had to become a specialist first, or find one.

The context

The recurring context was telemetry: the same class of noisy time-series problem appearing across telecommunications and banking, in telematics and IoT. The methods themselves are not specific to vehicles, which shaped the scope. The same five filters serve radar tracking, robot localisation, high-dimensional weather and ocean models, EEG, image denoising, and even smoothing signals in text.

What I did

I built TFiltersPy as an open-source Python library. The design decision that mattered was familiarity: every filter follows the scikit-learn convention, so fit, predict, score, get_params and set_params behave the way a practitioner already expects, and switching methods does not mean rewriting the code around them. It follows that convention rather than depending on scikit-learn, so the package installs with numpy, scipy and dask and nothing else. I also wrote the part people actually get stuck on, a decision guide for choosing among the five: a Kalman filter for linear systems, an Extended Kalman filter where you can supply Jacobians, an Unscented Kalman filter where you cannot, an Ensemble Kalman filter for very high-dimensional states, and a Particle filter for non-Gaussian or multimodal problems. It is built to scale beyond one machine: there are Dask-parallel variants of the Kalman and particle filters, and the ensemble filter propagates its members through Dask by default.

What changed

Filtering stopped being a re-derivation exercise and became fitting a familiar estimator. Beyond the forward pass, every filter has a filter_step call for online use against a live stream, the linear and extended filters add RTS smoothing, and the linear one forecasts a number of steps ahead. Particle degeneracy is visible rather than silent, recorded per step as an effective sample size, and the Kalman filter can drop its stored covariances for very long series, which trades the ability to smooth for the memory to keep going.

Who benefited

Engineers and scientists working with noisy time series who are not filtering specialists, starting with the telemetry problems across telecommunications and banking that it was built from.

What remained

A published, documented library on PyPI: five filters behind one API, worked examples for GPS vehicle tracking, radar tracking as a direct EKF against UKF comparison, and robot localisation, notebooks covering EEG, image denoising and benchmarks across all five, a decision guide for choosing between them, and a test suite of forty one tests run on Python 3.9 through 3.12.

Technical context

Python, NumPy, SciPy and Dask, an estimator API following the scikit-learn convention rather than depending on it, Dask-parallel Kalman and particle variants, a parameter estimator with four noise-estimation strategies, 41 tests on a Python 3.9 to 3.12 matrix, PyPI.

Lineage

Came before
kalmanfilter-. Kalman and particle filter implementations from first principles (2023). Its own description says the ideas became TFiltersPy.