Kalman and Bayesian Filters in Python
Free

Kalman and Bayesian Filters in Python

By Roger R Labbe Jr
Free
Book Description

Introductory textbook for Kalman filters and Bayesian filters. All code is written in Python, and the book itself is written in IPython Notebook so that you can run and modify the code in the book in place, seeing the results inside the book. What better way to learn?



You may access this book via nbviewer at any time by using this address: Read Online Now.



The book is written as a collection of IPython Notebooks, an interactive, browser based system that allows you to combine text, Python, and math into your browser. The website http://nbviewer.org provides an IPython Notebook server that renders notebooks stored at github (or elsewhere). The rendering is done in real time when you load the book. If you read my book today, and then I make a change tomorrow, when you go back tomorrow you will see that change. Perhaps more importantly, the book uses animations to demonstrate how the algorithms perform over time. The PDF version of the book cannot show the animations.

Table of Contents
  • Preface
    • Reading Online
    • PDF Version
    • Downloading the book
    • Version 0.0
    • Motivation
    • Installation and Software Requirements
    • Provided Libraries
    • Thoughts on Python and Coding Math
    • License
    • Contact
    • Resources
  • The g-h Filter
    • Building Intuition via Thought Experiments
    • The g-h Filter
    • Notation and Nomenclature
    • Exercise: Write Generic Algorithm
      • Solution and Discussion
    • Choice of g and h
    • Exercise: create measurement function
      • Solution
    • Exercise: Bad Initial Conditions
      • Solution and Discussion
    • Exercise: Extreme Noise
      • Solution and Discussion
    • Exercise: The Effect of Acceleration
      • Solution and Discussion
    • Exercise: Varying g
      • Solution and Discussion
    • Varying h
    • Tracking a Train
    • g-h Filters with FilterPy
    • Final Thoughts
    • Summary
    • References
  • Discrete Bayes Filter
    • Tracking a Dog
    • Extracting Information from Multiple Sensor Readings
    • Noisy Sensors
    • Incorporating Movement Data
    • Adding Noise to the Prediction
    • Integrating Measurements and Movement Updates
    • The Effect of Bad Sensor Data
    • Drawbacks and Limitations
    • Generalizing to Multiple Dimensions
    • Summary
    • References
  • Least Squares Filters
    • Introduction
  • Gaussian Probabilities
    • Introduction
    • Nomenclature
    • Gaussian Distributions
    • The Variance
    • Interactive Gaussians
    • Computational Properties of the Gaussian
    • Computing Probabilities with scipy.stats
    • Fat Tails
    • Summary and Key Points
    • References
  • One Dimensional Kalman Filters
    • One Dimensional Kalman Filters
    • Tracking A Dog
    • Math with Gaussians
    • Implementing the Update Step
    • Implementing Predictions
      • Animating the Tracking
    • Implementation in a Class
    • Relationship to the g-h Filter
      • Exercise: Modify Variance Values
    • Introduction to Designing a Filter
      • Animation
    • Exercise(optional):
      • Solution
      • Discussion
    • Explaining the Results - Multi-Sensor Fusion
    • More examples
      • Example: Extreme Amounts of Noise
      • Example: Bad Initial Estimate
      • Example: Large Noise and Bad Initial Estimate
    • Exercise: Interactive Plots
      • Solution
    • Exercise - Nonlinear Systems
      • Solution
      • Discussion
    • Exercise - Noisy Nonlinear Systems
      • Solution
      • Discussion
    • Summary
  • Multivariate Kalman Filters
    • Introduction
    • Multivariate Normal Distributions
    • Multiplying Multidimensional Gaussians
    • Unobserved Variables
    • Kalman Filter Algorithm
    • The Equations
      • Kalman Equations Expressed as an Algorithm
    • Implementation in Python
    • Tracking a Dog
      • Step 1: Choose the State Variables and Set Initial Conditions
      • Step 2: Design the State Transition Function
      • Step 3: Design the Motion Function
      • Step 4: Design the Measurement Function
      • Step 5: Design the Measurement Noise Matrix
      • Step 6: Design the Process Noise Matrix
    • Implementing the Kalman Filter
    • Compare to Univariate Kalman Filter
      • Discussion
    • Converting the Multivariate Equations to the Univariate Case
    • Exercise: Compare to a Filter That Incorporates Velocity
      • Solution
      • Discussion
    • Adjusting the Filter
    • A Detailed Examination of the Covariance Matrix
    • Question: Explain Ellipse Differences
      • Solution
    • Batch Processing
    • Smoothing the Results
    • Walking Through the KalmanFilter Code (Optional)
    • References
  • Kalman Filter Math
    • Bayesian Probability
      • Bayes' theorem
    • Modeling a Dynamic System that Has Noise
    • Modeling Dynamic Systems
      • Why This is Hard
      • Finding the Fundamental Matrix for Time Invariant Systems
      • Forming First Order Equations from Higher Order Equations
    • Walking Through the Kalman Filter Equations
    • Design of the Process Noise Matrix
      • Continuous White Noise Model
      • Piecewise White Noise Model
      • Using FilterPy to Compute Q
      • Simplification of Q
    • Numeric Integration of Differential Equations
      • Runge Kutta Methods
    • Iterative Least Squares for Sensor Fusion
      • Derivation of ILS Equations (Optional)
      • Implementing Iterative Least Squares
    • References
  • Designing Kalman Filters
    • Introduction
    • Tracking a Robot
      • Step 1: Choose the State Variables
      • Step 2: Design State Transition Function
      • Step 3: Design the Motion Function
      • Step 4: Design the Measurement Function
      • Step 5: Design the Measurement Noise Matrix
      • Step 6: Design the Process Noise Matrix
      • Step 7: Design Initial Conditions
    • Implement the Filter Code
    • The Effect of Order
      • Zero Order Kalman Filter
      • First Order Kalman Filter
      • Second Order Kalman Filter
      • Evaluating the Performance
    • Sensor Fusion
      • Exercise: Can you Kalman Filter GPS outputs?
      • Excercise: Prove that the PS improves the filter
      • Exercise: Different Data Rates
    • Tracking a Ball
      • Step 1: Choose the State Variables
      • Step 2: Design State Transition Function
      • Interlude: Test State Transition
      • Step 3: Design the Motion Function
      • Step 4: Design the Measurement Function
      • Step 5: Design the Measurement Noise Matrix
      • Step 6: Design the Process Noise Matrix
      • Step 7: Design the Initial Conditions
    • Tracking a Ball in Air
      • Implementing Air Drag
    • Tracking Noisy Data
  • Nonlinear Filtering
    • Introduction
    • The Problem with Nonlinearity
    • An Intuitive Look at the Problem
    • The Effect of Nonlinear Functions on Gaussians
    • A 2D Example
    • The Algorithms
    • Summary
  • Unscented Kalman Filters
    • Choosing Sigma Points
    • Handling the Nonlinearities
    • Sigma Point Algorithm
    • The Unscented Transform
    • The Unscented Filter
      • Predict Step
      • Update Step
    • Using the UKF
    • Tracking a Flying Airplane
      • First Attempt
      • Tracking Manuevering Aircraft
      • Sensor Fusion
      • Multiple Position Sensors
    • Exercise: Track a target moving in a circle
      • Solution
      • Discussion
    • Exercise: Sensor Position Effects
      • Solution
    • Exercise: Compute Position Errors
      • Solution
      • Discussion
    • Exercise: Explain Filter Performance
      • Solution
    • Exercise: Visualize Sigma Points
      • Solution
      • Discussion
    • Implementation of the UKF
      • Weights
      • Sigma Points
      • Predict Step
      • Update Step
    • Full Source from FilterPy
    • Batch Processing
    • Smoothing the Results
    • Choosing Values for kappa
    • The Skewed Unscented Transform
    • The Scaled Unscented Transform
    • Nonlinear State Variables
    • References
  • The Extended Kalman Filter
    • The Problem with Nonlinearity
    • The Effect of Nonlinear Transfer Functions on Gaussians
    • The Extended Kalman Filter
    • Example: Tracking a Flying Airplane
      • Design the State Variables
      • Design the System Model
      • Design the Measurement Model
    • Using SymPy to compute Jacobians
    • Designing Q
    • Example: A falling Ball
  • Designing Nonlinear Kalman Filters
    • Introduction
      • Kalman Filter with Air Drag
    • Realistic 2D Position Sensors
    • Linearizing the Kalman Filter
    • References
  • Smoothing
    • Introduction
    • Types of Smoothers
    • Fixed Point Smoothing
    • Fixed Lag Smoothing
    • Fixed Interval Smoothing
    • References
  • Adaptive Filtering
    • Introduction
    • Maneuvering Targets
    • Detecting a Maneuver
    • Adjustable Process Noise
      • Continuous Adjustment
      • Continuous Adjustment - Standard Deviation Version
    • Fading Memory Filter
    • Noise Level Switching
    • Variable State Dimension
    • Multiple Model Estimation
    • References
  • H filter
  • Ensemble Kalman Filters
    • The Algorithm
      • Initialize Step
      • Predict Step
      • Update Step
    • Implementation and Example
    • Outstanding Questions
    • References
  • Installation, Python, Numpy, and filterpy
    • Installing the SciPy Stack
      • Manual Install of the SciPy stack
    • Installing/downloading and running the book
    • Using IPython Notebook
    • SymPy
  • Symbology
    • State
    • State at step n
    • Prediction
    • measurement
    • control transition Matrix
  • Nomenclature
    • Equations
      • Brookner
      • Gelb
      • Brown
      • Zarchan
      • Wikipedia
      • Labbe
    No review for this book yet, be the first to review.
      No comment for this book yet, be the first to comment
      Also Available On
      App store smallGoogle play small
      Categories
      Curated Lists
      • Pattern Recognition and Machine Learning (Information Science and Statistics)
        by Christopher M. Bishop
        Data mining
        by I. H. Witten
        The Elements of Statistical Learning: Data Mining, Inference, and Prediction
        by Various
        See more...
      • CK-12 Chemistry
        by Various
        Concept Development Studies in Chemistry
        by John Hutchinson
        An Introduction to Chemistry - Atoms First
        by Mark Bishop
        See more...
      • Microsoft Word - How to Use Advanced Algebra II.doc
        by Jonathan Emmons
        Advanced Algebra II: Activities and Homework
        by Kenny Felder
        de2de
        by
        See more...
      • The Sun Who Lost His Way
        by
        Tania is a Detective
        by Kanika G
        Firenze_s-Light
        by
        See more...
      • Java 3D Programming
        by Daniel Selman
        The Java EE 6 Tutorial
        by Oracle Corporation
        JavaKid811
        by
        See more...