Skip to content

SaiSampathKedari/Bayesian-Filtering-and-Smoothing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bayesian Filtering and Smoothing

Python Jupyter Last Commit Stars License

A practical and conceptual study of Bayesian filtering and smoothing for systems whose internal states are not directly observable and evolve over time under uncertainty.
The emphasis is on inference, not simulation: how noisy measurements and imperfect models are combined to reason about hidden states, and how uncertainty propagates through time.


Overview

In robotics and dynamical systems, the true state of a system is rarely known exactly. Instead, we observe noisy sensor data and rely on approximate models of system dynamics. Bayesian filtering and smoothing provide a principled framework for state estimation under uncertainty, where the system state is treated as a random variable rather than a deterministic quantity.

This repository builds these ideas step by step, starting from linear Gaussian models and Bayesian regression, and progressing toward recursive Bayesian filters and particle-based methods. Emphasis is placed on understanding:

  • what is uncertain,
  • where that uncertainty comes from,
  • how it propagates through time,
  • and why filtering methods succeed or fail in practice.

The material is developed through formal derivations (PDFs), executable notebooks, and diagnostic visualizations, closely tied to probabilistic modeling foundations.


Topics Covered (and in progress)

  • Linear Gaussian estimation and covariance inference
  • Batch vs recursive Bayesian regression
  • Kalman Filter (KF)
  • Extended Kalman Filter (EKF)
  • Unscented Kalman Filter (UKF)
  • Gauss–Hermite Kalman Filter (GHKF)
  • Particle Filtering (bootstrap and EKF/UKF-based proposals)
  • Importance sampling, weight degeneracy, ESS, and resampling
  • Practical diagnostics and failure modes

Filtering Visualizations

The following animations show Bayesian state estimation on a nonlinear pendulum, comparing different Gaussian filtering methods.
Each animation overlays the true system trajectory, noisy measurements, and the filter’s estimated state evolution.

Extended Kalman Filter (EKF)

State estimation for a nonlinear pendulum using EKF. Linearization error and approximation effects are visible.


Gauss–Hermite Kalman Filter (GHKF)

   

GHKF with order 3 (left) and order 5 (right), showing improved nonlinear moment approximation with higher quadrature order.


Unscented Kalman Filter (UKF)

UKF state estimation using sigma-point propagation for nonlinear dynamics.


These visualizations are generated directly from the filtering implementations in src/filters and are used to study approximation quality, consistency, and failure modes across methods.


Notebook Gallery

Chapter 1: Linear Gaussian Regression

Chapter 2: Bayesian Filtering


PDF Notes and Derivations

Formal derivations and conceptual write-ups supporting the implementations:

  • 01_linear_gaussian_estimation_covariance_inference.pdf
  • 02_Linear_Gaussian_Regression_Batch_Recursive.pdf
  • 03_Bayesian_modeling_for_Dynamical_Systems.pdf
  • 04_Bayesian_Filtering_Equations.pdf
  • 05_Gaussian_Filtering_Equations.pdf
  • 06_Kalman_Filtering_Equations.pdf
  • 07_Extended_Kalman_Filtering_Equations.pdf
  • 10_Gaussian_Filtering_Summary_and_motivation_for_ParticleFiltering.pdf
  • 11_PF_Empirical_Distributions_and_Importance_Sampling_Foundations.pdf
  • 12_Sequential_Self-Normalized_Importance_Sampling.pdf
  • 13_WeightDegeneracy_ESS_Resampling.pdf
  • 15_Optimal_Importance_Proposal_for_ParticleFiltering.pdf
  • 16_GaussianApproximations_of_the_OptimalProposal_in_ParticleFiltering.pdf
  • 17_OptimalProposal_for_LinearMeasurementModel_in_ParticleFiltering.pdf

Project Structure

Bayesian-Filtering-and-Smoothing/
│
├── images/
│   ├── bayesian_filtering/
│   └── regression/
│
├── notebooks/
│   ├── ch01_regression/
│   └── ch02_filtering/
│
├── reports/
│
├── src/
│   ├── regression/
│   │   └── linear_regression.py
│   │
│   ├── filters/
│   │   ├── kalman_filter.py
│   │   ├── extended_kalman_filter.py
│   │   ├── unscented_kalman_filter.py
│   │   ├── gauss_hermite_kalman_filter.py
│   │   ├── particle_filter.py
│   │   ├── bootstrap_particle_filter.py
│   │   ├── ekf_particle_filter.py
│   │   └── ukf_particle_filter.py
│   │
│   └── models/
│       └── pendulum.py
│
├── README.md
└── pyproject.toml


Status

🚧 Under active development

Further extensions include smoother implementations, deeper diagnostic studies, and tighter integration between Gaussian and particle-based methods.


About Me

I study and implement methods in optimization, control, robotics, Bayesian inference, and probabilistic reasoning.

About

This repository focuses on estimating hidden states of systems that evolve over time under uncertainty using Bayesian filtering and smoothing methods. It examines how noisy measurements and imperfect models are combined to track system behavior, with attention to practical limitations and failure modes in real applications.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors