epymorph.parameter_fitting.particlefilter_simulation
This module provides a simulation class for running particle filters on epidemiological data.
The FilterSimulation
class initializes with the necessary parameters,
validates inputs, and runs the particle filter simulation.
Dependencies: - numpy: For numerical operations. - pandas: For data manipulation. - epymorph: Custom package providing filter and likelihood functionalities.
FilterSimulation
FilterSimulation(
rume: RUME,
filter_type: BaseFilter,
params_space: Dict[str, EstimateParameters],
observations: Observations,
)
A class to run particle filter simulations on epidemiological data.
This class is initialized with epidemiological parameters, likelihood function, filter type, parameter space, and observational data. It validates these inputs and runs the particle filter to produce simulation results.
Attributes:
-
rume
(Rume
) –Runtime environment for the simulation, containing necessary parameters.
-
likelihood_fn
(Likelihood
) –The likelihood function to be used.
-
filter_type
(BaseFilter
) –Type of filter (e.g., Particle Filter) to be used in the simulation.
-
params_space
(Dict[str, EstimateParameters]
) –Parameter estimates for the simulation.
-
observations
(Observations
) –Observational data to be used in the simulation.
-
dataloader
(DataLoader
) –A DataLoader instance to handle loading of observational data.
-
dates
(ndarray
) –The dates associated with the observational data.
-
cases
(ndarray
) –The case counts associated with the observational data.
Parameters:
-
rume
(Rume
) –Runtime environment or configuration for the epidemiological model.
-
filter_type
(BaseFilter
) –Type of particle filter to be used.
-
params_space
(Dict[str, EstimateParameters]
) –The parameters to estimate.
-
observations
(Observations
) –An object containing observational data.
Raises:
-
ValueError
–If any of the input arguments are invalid.
validate
Validates the input parameters for the simulation.
Ensures that the likelihood function, filter type, model link, and parameter estimates are valid.
Raises:
-
ValueError
–If any required field is missing or if the types are incorrect.
run
run(rng: Generator | None = None) -> ParticleFilterOutput
Runs the particle filter simulation.
Parameters:
-
rng
(Generator | None
, default:None
) –The random number generator used by the particle filter. It is also passed to the simulator during particle propagation.
Returns:
-
ParticleFilterOutput
–The output of the filter simulation containing results.