tfp.experimental.sequential.IteratedFilter

View source on GitHub

A model augmented with parameter perturbations for iterated filtering.

parameter_prior prior tfd.Distribution over parameters (may be a joint distribution).
parameterized_initial_state_prior_fn callable with signature initial_state_prior = parameterized_initial_state_prior_fn(parameters) where parameters has the form of a sample from parameter_prior, and initial_state_prior is a distribution over the initial state.
parameterized_transition_fn callable with signature next_state_dist = parameterized_transition_fn( step, state, parameters, **kwargs).
parameterized_observation_fn callable with signature observation_dist = parameterized_observation_fn( step, state, parameters, **kwargs).
parameterized_initial_state_proposal_fn optional callable with signature initial_state_proposal = parameterized_initial_state_proposal_fn(parameters) where parameters has the form of a sample from parameter_prior, and initial_state_proposal is a distribution over the initial state.
parameterized_proposal_fn optional callable with signature next_state_dist = parameterized_transition_fn( step, state, parameters, **kwargs). Default value: None.
parameter_constraining_bijector optional tfb.Bijector instance such that parameter_constraining_bijector.forward(x) returns valid parameters for any real-valued x of the same structure and shape as parameters. If None, the default bijector of the provided parameter_prior will be used. Default value: None.
name str name for ops constructed by this object. Default value: iterated_filter.

batch_ndims

joint_initial_state_prior Initial state prior for the joint (augmented) model.
joint_observation_fn Observation function for the joint (augmented) model.
joint_proposal_fn Proposal function for the joint (augmented) model.
joint_transition_fn Transition function for the joint (augmented) model.
name

parameter_constraining_bijector Bijector mapping unconstrained real values into the parameter space.
parameter_prior Prior distribution on parameters passed in at construction.
parameterized_initial_state_prior_fn Prior function that was passed in at construction.
parameterized_initial_state_proposal_fn Initial proposal function passed in at construction.

Methods

estimate_parameters

View source

Runs multiple iterations of filtering following a cooling schedule.

Args
observations observed Tensor value(s) on which to condition the parameter estimate.
num_iterations intTensornumber of filtering iterations to run. </td> </tr><tr> <td>num_particles</td> <td> scalar intTensornumber of particles to use. </td> </tr><tr> <td>initial_perturbation_scale</td> <td> scalar floatTensor, or any structure of floatTensors broadcasting to the same shape as the (unconstrained) parameters, specifying the scale (standard deviation) of Gaussian perturbations to each parameter at the first timestep. </td> </tr><tr> <td>cooling_schedule</td> <td> callable with signaturecooling_factor = cooling_schedule(iteration)foriterationin[0, ..., num_iterations - 1]. The filter is invoked with perturbations of scaleinitial_perturbation_scale * cooling_schedule(iteration). </td> </tr><tr> <td>seed</td> <td> intTensorseed for random ops. </td> </tr><tr> <td>name</td> <td>strname for ops constructed by this method. </td> </tr><tr> <td>**kwargs` additional keyword arguments passed to tfp.experimental.mcmc.infer_trajectories.

Returns
final_parameter_particles structure of Tensors matching self.parameter_prior, each with batch shape [num_iterations, num_particles]. These are the populations of particles representing the parameter estimate after each iteration of filtering.

joint_initial_state_proposal

View source

Proposal to initialize the model with given parameter particles.

one_step

View source

Runs one step of filtering to sharpen parameter estimates.

Args
observations observed Tensor value(s) on which to condition the parameter estimate.
perturbation_scale scalar float Tensor, or any structure of float Tensors broadcasting to the same shape as the unconstrained parameters, specifying the scale (standard deviation) of Gaussian perturbations to each parameter at each timestep.
num_particles scalar int Tensor number of particles to use. Must match the batch dimension of initial_unconstrained_parameters, if specified.
initial_unconstrained_parameters optional structure of Tensors, of shape matching self.joint_initial_state_prior.sample([ num_particles]).unconstrained_parameters, used to initialize the filter. Default value: None.
seed int Tensor seed for random ops.
name str name for ops constructed by this method.
**kwargs additional keyword arguments passed to tfp.experimental.mcmc.infer_trajectories.

Returns
final_unconstrained_parameters structure of Tensors matching initial_unconstrained_parameters, containing samples of unconstrained parameters at the final timestep, as computed by self.filter_fn.