Model Estimation

aftercovid.models.find_best_model(Xt, yt, lrs, stop_loss, verbose=0, init=None, model_name='SIRD', max_iter=500)[source]

Finds the best model over a short period of time.

Parameters
  • Xt – matrix Nx4 with times series

  • Yt – matrix Nx4 with expected differentiated time series

  • lrs – learning rates to try

  • stop_loss – stops trying other learning rate if the loss is below this threshold

  • verbose – display progress information (uses print)

  • init – initialized model to start the optimisation from this parameters

  • model_name – name of the model to optimize, ‘SIRD’, ‘SIRDc’, see EpidemicRegressor

  • max_iter – maximum number of iterator to train every model

Returns

(best model, best loss, best learning rate)

aftercovid.models.rolling_estimation(X, y, lrs=(100000000.0, 1000000.0, 10000.0, 100.0, 1, 0.01, 0.0001, 1e-06), delay=21, stop_loss=1, init=None, model_name='SIRD', max_iter=500, verbose=0, dates=None)[source]

Estimates a model over a rolling windows whose size is delay days. See Estimation d’un modèle to see how to use that function.

Parameters
  • Xt – matrix Nx4 with times series

  • Yt – matrix Nx4 with expected differentiated time series

  • lrs – learning rates to try

  • delay – size of the rolling window

  • stop_loss – stops trying other learning rate if the loss is below this threshold

  • verbose – display progress information (uses print)

  • init – initialized model to start the optimisation from this parameters

  • model_name – name of the model to optimize, ‘SIRD’, ‘SIRDc’, see EpidemicRegressor

  • max_iter – maximum number of iterator to train every model

  • dates – dates for every row in X, can be None

Returns

(results, last best model)