pypomp.functional.pfilter

pypomp.functional.pfilter(struct: PompStruct, thetas_array: Array, J: int, keys: Array, thresh: float = 0.0, CLL: bool = False, ESS: bool = False, filter_mean: bool = False, prediction_mean: bool = False) dict[str, Array][source]

Run the bootstrap particle filter on a POMP model struct.

Pure-functional implementation intended for users who need to compose the particle filter within custom JAX loops or higher-order functions. For the standard interface, see pypomp.Pomp.pfilter().

JAX vectorises the computation across all parameter sets in thetas_array simultaneously.

Parameters:
  • struct (PompStruct) – Compiled structural representation of the POMP model. Obtain via to_struct().

  • thetas_array (jax.Array) – Parameter array of shape (n_reps, n_params) on the natural scale. Must be aligned with struct.param_names (e.g. via align_params()).

  • J (int) – Number of particles.

  • keys (jax.Array) – Random keys of shape (n_reps, reps, ...).

  • thresh (float, optional) – ESS-based resampling threshold. Defaults to 0.0.

  • CLL (bool, optional) – Compute conditional log-likelihoods. Defaults to False.

  • ESS (bool, optional) – Compute effective sample size. Defaults to False.

  • filter_mean (bool, optional) – Compute filtered state means. Defaults to False.

  • prediction_mean (bool, optional) – Compute predicted state means. Defaults to False.

Returns:

Always contains 'logLik'. Optionally contains 'CLL', 'ESS', 'filter_mean', and 'prediction_mean' if their corresponding flags are True.

Return type:

dict of str to jax.Array

Notes

To align and stack input parameter arrays into the correct canonical ordering, use pypomp.functional.align_params().

See also

pypomp.Pomp.pfilter

Object-oriented interface.

align_params

Parameter alignment utility.