lisphilar / covid19-sir

CovsirPhy: Python library for COVID-19 analysis with phase-dependent SIR-derived ODE models.
https://lisphilar.github.io/covid19-sir/
Apache License 2.0
110 stars 44 forks source link

[Fix] [forecasting] error handling is not clear when a error is raised with regressor #784

Closed lisphilar closed 3 years ago

lisphilar commented 3 years ago

Summary

Error handling is not clear when some errors is raised with regressor. When a internal ValueError occurs, the error description is always ValueError: max() arg is an empty sequence. This is related to #778.

Codes

import covsirphy as cs
# Dataset preparation
data_loader = cs.DataLoader("input")
jhu_data = data_loader.jhu()
oxcgr_data = data_loader.oxcgrt()
# Scenario analysis
snl = cs.Scenario(country="Italy")
snl.register(jhu_data, extras=[oxcgrt_data]))
snl.trend()
snl.estimate(cs.SIRF)
snl.fit()

Outputs

If some ValueError occured with regressors, ValueError: max() arg is an empty sequence.

Environment

lisphilar commented 3 years ago

When all regressors failed in select delay value (i.e. some parameter values are out of (0, 1)), UnExpectedReturnValueError will be returned.