gs_quant.models.epidemiology.EpidemicModel¶
- class EpidemicModel(model, parameters=None, data=None, initial_conditions=None, fit_method='leastsq', error=None, fit_period=None)[source]¶
Class to perform solutions and parameter-fitting of epidemic models
- __init__(model, parameters=None, data=None, initial_conditions=None, fit_method='leastsq', error=None, fit_period=None)[source]¶
A class to standardize fitting and solving epidemiological models.
- Parameters:
model (
Type
[CompartmentalModel
]) – the model to use, currently a class in the form of SIR, SEIR aboveparameters (
Optional
[tuple
]) – tuple, parameters to use for the model, defaults to the output of [model].get_parametersdata (
Optional
[array
]) – np.array, data that can be used to calibrate the modelinitial_conditions (
Optional
[list
]) – list, initial conditions for the modelfit_method (
str
) – str, the method to use to minimize the (given) error. Available methods are those in the lmfit.minimizer.minimize function. Default is Levenberg-Marquardt least squares minimization.error (
Optional
[callable
]) – callable, control which residuals (and in what form) to minimize for fitting.fit_period (
Optional
[float
]) – float, how far back to fit the data, defaults to fitting all data
Methods
__init__
(model[, parameters, data, ...])A class to standardize fitting and solving epidemiological models.
fit
([time_range, parameters, ...])Fit the model based on data in the form np.array([X1,...,Xn])
residual
(parameters, time_range, data)Obtain fit error (to minimize).
solve
(time_range, initial_conditions, parameters)Integrate the model ODEs to get a solution.