# InformationFilter¶

## Introduction and Overview¶

This is a basic implementation of the information filter.

Copyright 2015 Roger R Labbe Jr.

FilterPy library. http://github.com/rlabbe/filterpy

Supporting book at: https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python

class filterpy.kalman.InformationFilter(dim_x, dim_z, dim_u=0, compute_log_likelihood=True)[source]

Create a linear Information filter. Information filters compute the inverse of the Kalman filter, allowing you to easily denote having no information at initialization.

You are responsible for setting the various state variables to reasonable values; the defaults below will not give you a functional filter.

Parameters: dim_x : int Number of state variables for the filter. For example, if you are tracking the position and velocity of an object in two dimensions, dim_x would be 4. This is used to set the default size of P, Q, and u dim_z : int Number of of measurement inputs. For example, if the sensor provides you with position in (x,y), dim_z would be 2. dim_u : int (optional) size of the control input, if it is being used. Default value of 0 indicates it is not used. self.compute_log_likelihood = compute_log_likelihood self.log_likelihood = math.log(sys.float_info.min)

Examples

See my book Kalman and Bayesian Filters in Python https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python

__init__(dim_x, dim_z, dim_u=0, compute_log_likelihood=True)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

update(z, R_inv=None)[source]

Add a new measurement (z) to the kalman filter. If z is None, nothing is changed.

Parameters: z : np.array measurement for this update. R : np.array, scalar, or None Optionally provide R to override the measurement noise for this one call, otherwise self.R will be used.
predict(u=0)[source]

Predict next position.

Parameters: u : ndarray Optional control vector. If non-zero, it is multiplied by B to create the control input into the system.
batch_filter(zs, Rs=None, update_first=False, saver=None)[source]

Batch processes a sequences of measurements.

Parameters: zs : list-like list of measurements at each time step self.dt Missing measurements must be represented by ‘None’. Rs : list-like, optional optional list of values to use for the measurement error covariance; a value of None in any position will cause the filter to use self.R for that time step. update_first : bool, optional, controls whether the order of operations is update followed by predict, or predict followed by update. Default is predict->update. saver : filterpy.common.Saver, optional filterpy.common.Saver object. If provided, saver.save() will be called after every epoch means: np.array((n,dim_x,1)) array of the state for each time step. Each entry is an np.array. In other words means[k,:] is the state at step k. covariance: np.array((n,dim_x,dim_x)) array of the covariances for each time step. In other words covariance[k,:,:] is the covariance at step k.
F

State Transition matrix

P

State covariance matrix