Priesemann-Group / covid19_inference

Bayesian python toolbox for inference and forecast of the spread of the Coronavirus
GNU General Public License v3.0
73 stars 70 forks source link

Error with Trace(MCMC) in Example_bundeslaender #55

Closed Quan-kas closed 4 years ago

Quan-kas commented 4 years ago

Hello good afternoon, I am running the Scripts in Google Colab, specifically the "example_bundeslaender" did not modify anything, I just wanted to see if the code ran well, to use my data for my country, but I get this error in the MCMC use line:

trace = pm.sample(model=this_model, tune=1000, draws=1000, init="advi+adapt_diag") Run: Auto-assigning NUTS sampler... INFO [pymc3] Auto-assigning Initializing NUTS using advi+adapt_diag... INFO [pymc3] Initializing NUTS using advi+adapt_diag... Average Loss = 5,425.7: 1%| | 2141/200000 [00:14<22:39, 145.56it/s]

`FloatingPointError Traceback (most recent call last)

in () ----> 1 trace = pm.sample(model=this_model, tune=1000, draws=1000, init="advi+adapt_diag")` `4 frames` `/usr/local/lib/python3.6/dist-packages/pymc3/variational/inference.py in _iterate_with_loss(self, s, n, step_func, progress, callbacks)` ` 216 except IndexError: 217 pass --> 218 raise FloatingPointError('\n'.join(errmsg)) 219 scores[i] = e 220 if i % 10 == 0:` FloatingPointError: NaN occurred in optimization. The current approximation of RV `delay_hc_L1_log`.ravel()[0] is NaN. The current approximation of RV `lambda_1_hc_L2_log_raw_`.ravel()[0] is NaN. The current approximation of RV `lambda_1_hc_L2_log_raw_`.ravel()[1] is NaN. The current approximation of RV `lambda_1_hc_L2_log_raw_`.ravel()[2] is NaN. The current approximation of RV `lambda_1_hc_L2_log_raw_`.ravel()[3] is NaN. The current approximation of RV `lambda_1_hc_L2_log_raw_`.ravel()[4] is NaN. The current approximation of RV `lambda_1_hc_L2_log_raw_`.ravel()[5] is NaN. The current approximation of RV `lambda_1_hc_L2_log_raw_`.ravel()[6] is NaN. The current approximation of RV `lambda_1_hc_L2_log_raw_`.ravel()[7] is NaN. The current approximation of RV `lambda_1_hc_L2_log_raw_`.ravel()[8] is NaN. The current approximation of RV `lambda_1_hc_L2_log_raw_`.ravel()[9] is NaN. The current approximation of RV `lambda_1_hc_L2_log_raw_`.ravel()[10] is NaN. The current approximation of RV `lambda_1_hc_L2_log_raw_`.ravel()[11] is NaN. The current approximation of RV `lambda_1_hc_L2_log_raw_`.ravel()[12] is NaN. The current approximation of RV `lambda_1_hc_L2_log_raw_`.ravel()[13] is NaN. The current approximation of RV `lambda_1_hc_L2_log_raw_`.ravel()[14] is NaN. The current approximation of RV `lambda_1_hc_L2_log_raw_`.ravel()[15] is NaN. The current approximation of RV `transient_len_3_hc_L2_log_raw_`.ravel()[0] is NaN. The current approximation of RV `transient_len_3_hc_L2_log_raw_`.ravel()[1] is NaN. The current approximation of RV `transient_len_3_hc_L2_log_raw_`.ravel()[2] is NaN. The current approximation of RV `transient_len_3_hc_L2_log_raw_`.ravel()[3] is NaN. The current approximation of RV `transient_len_3_hc_L2_log_raw_`.ravel()[4] is NaN. The current approximation of RV `transient_len_3_hc_L2_log_raw_`.ravel()[5] is NaN. The current approximation of RV `transient_len_3_hc_L2_log_raw_`.ravel()[6] is NaN. The current approximation of RV `transient_len_3_hc_L2_log_raw_`.ravel()[7] is NaN. The current approximation of RV `transient_len_3_hc_L2_log_raw_`.ravel()[8] is NaN. The current approximation of RV `transient_len_3_hc_L2_log_raw_`.ravel()[9] is NaN. The current approximation of RV `transient_len_3_hc_L2_log_raw_`.ravel()[10] is NaN. The current approximation of RV `transient_len_3_hc_L2_log_raw_`.ravel()[11] is NaN. The current approximation of RV `transient_len_3_hc_L2_log_raw_`.ravel()[12] is NaN. The current approximation of RV `transient_len_3_hc_L2_log_raw_`.ravel()[13] is NaN. The current approximation of RV `transient_len_3_hc_L2_log_raw_`.ravel()[14] is NaN. The current approximation of RV `transient_len_3_hc_L2_log_raw_`.ravel()[15] is NaN. The current approximation of RV `I_begin_ratio_log`.ravel()[0] is NaN. The current approximation of RV `I_begin_ratio_log`.ravel()[1] is NaN. The current approximation of RV `I_begin_ratio_log`.ravel()[2] is NaN. The current approximation of RV `I_begin_ratio_log`.ravel()[3] is NaN. The current approximation of RV `I_begin_ratio_log`.ravel()[4] is NaN. The current approximation of RV `I_begin_ratio_log`.ravel()[5] is NaN. The current approximation of RV `I_begin_ratio_log`.ravel()[6] is NaN. The current approximation of RV `I_begin_ratio_log`.ravel()[7] is NaN. The current approximation of RV `I_begin_ratio_log`.ravel()[8] is NaN. The current approximation of RV `I_begin_ratio_log`.ravel()[9] is NaN. The current approximation of RV `I_begin_ratio_log`.ravel()[10] is NaN. The current approximation of RV `I_begin_ratio_log`.ravel()[11] is NaN. The current approximation of RV `I_begin_ratio_log`.ravel()[12] is NaN. The current approximation of RV `I_begin_ratio_log`.ravel()[13] is NaN. The current approximation of RV `I_begin_ratio_log`.ravel()[14] is NaN. The current approximation of RV `I_begin_ratio_log`.ravel()[15] is NaN. The current approximation of RV `lambda_0_hc_L1_log_`.ravel()[0] is NaN. The current approximation of RV `sigma_weekend_factor_log__`.ravel()[0] is NaN. The current approximation of RV `transient_day_1_hc_L1`.ravel()[0] is NaN. The current approximation of RV `transient_len_3_hc_L1_log`.ravel()[0] is NaN. The current approximation of RV `lambda_1_hc_L1_log`.ravel()[0] is NaN. The current approximation of RV `sigma_lambda_1_hc_L1_log__`.ravel()[0] is NaN. The current approximation of RV `weekend_factor_hc_L1_log`.ravel()[0] is NaN. The current approximation of RV `sigma_transient_len_3_log__`.ravel()[0] is NaN. The current approximation of RV `delay_hc_sigma_log__`.ravel()[0] is NaN. The current approximation of RV `lambda_0_hc_L2_log_raw_`.ravel()[0] is NaN. The current approximation of RV `lambda_0_hc_L2_log_raw_`.ravel()[1] is NaN. The current approximation of RV `lambda_0_hc_L2_log_raw_`.ravel()[2] is NaN. The current approximation of RV `lambda_0_hc_L2_log_raw_`.ravel()[3] is NaN. The current approximation of RV `lambda_0_hc_L2_log_raw_`.ravel()[4] is NaN. The current approximation of RV `lambda_0_hc_L2_log_raw_`.ravel()[5] is NaN. The current approximation of RV `lambda_0_hc_L2_log_raw_`.ravel()[6] is NaN. The current approximation of RV `lambda_0_hc_L2_log_raw_`.ravel()[7] is NaN. The current approximation of RV `lambda_0_hc_L2_log_raw_`.ravel()[8] is NaN. The current approximation of RV `lambda_0_hc_L2_log_raw_`.ravel()[9] is NaN. The current approximation of RV `lambda_0_hc_L2_log_raw_`.ravel()[10] is NaN. The current approximation of RV `lambda_0_hc_L2_log_raw_`.ravel()[11] is NaN. The current approximation of RV `lambda_0_hc_L2_log_raw_`.ravel()[12] is NaN. The current approximation of RV `lambda_0_hc_L2_log_raw_`.ravel()[13] is NaN. The current approximation of RV `lambda_0_hc_L2_log_raw_`.ravel()[14] is NaN. The current approximation of RV `lambda_0_hc_L2_log_raw_`.ravel()[15] is NaN. The current approximation of RV `offset_modulation_rad_circular__`.ravel()[0] is NaN. The current approximation of RV `transient_day_1_hc_L2_raw_`.ravel()[0] is NaN. The current approximation of RV `transient_day_1_hc_L2_raw_`.ravel()[1] is NaN. The current approximation of RV `transient_day_1_hc_L2_raw_`.ravel()[2] is NaN. The current approximation of RV `transient_day_1_hc_L2_raw_`.ravel()[3] is NaN. The current approximation of RV `transient_day_1_hc_L2_raw_`.ravel()[4] is NaN. The current approximation of RV `transient_day_1_hc_L2_raw_`.ravel()[5] is NaN. The current approximation of RV `transient_day_1_hc_L2_raw_`.ravel()[6] is NaN. The current approximation of RV `transient_day_1_hc_L2_raw_`.ravel()[7] is NaN. The current approximation of RV `transient_day_1_hc_L2_raw_`.ravel()[8] is NaN. The current approximation of RV `transient_day_1_hc_L2_raw_`.ravel()[9] is NaN. The current approximation of RV `transient_day_1_hc_L2_raw_`.ravel()[10] is NaN. The current approximation of RV `transient_day_1_hc_L2_raw_`.ravel()[11] is NaN. The current approximation of RV `transient_day_1_hc_L2_raw_`.ravel()[12] is NaN. The current approximation of RV `transient_day_1_hc_L2_raw_`.ravel()[13] is NaN. The current approximation of RV `transient_day_1_hc_L2_raw_`.ravel()[14] is NaN. The current approximation of RV `transient_day_1_hc_L2_raw_`.ravel()[15] is NaN. The current approximation of RV `delay_hc_L2_log_raw_`.ravel()[0] is NaN. The current approximation of RV `delay_hc_L2_log_raw_`.ravel()[1] is NaN. The current approximation of RV `delay_hc_L2_log_raw_`.ravel()[2] is NaN. The current approximation of RV `delay_hc_L2_log_raw_`.ravel()[3] is NaN. The current approximation of RV `delay_hc_L2_log_raw_`.ravel()[4] is NaN. The current approximation of RV `delay_hc_L2_log_raw_`.ravel()[5] is NaN. The current approximation of RV `delay_hc_L2_log_raw_`.ravel()[6] is NaN. The current approximation of RV `delay_hc_L2_log_raw_`.ravel()[7] is NaN. The current approximation of RV `delay_hc_L2_log_raw_`.ravel()[8] is NaN. The current approximation of RV `delay_hc_L2_log_raw_`.ravel()[9] is NaN. The current approximation of RV `delay_hc_L2_log_raw_`.ravel()[10] is NaN. The current approximation of RV `delay_hc_L2_log_raw_`.ravel()[11] is NaN. The current approximation of RV `delay_hc_L2_log_raw_`.ravel()[12] is NaN. The current approximation of RV `delay_hc_L2_log_raw_`.ravel()[13] is NaN. The current approximation of RV `delay_hc_L2_log_raw_`.ravel()[14] is NaN. The current approximation of RV `delay_hc_L2_log_raw_`.ravel()[15] is NaN. The current approximation of RV `sigma_lambda_0_hc_L1_log__`.ravel()[0] is NaN. The current approximation of RV `sigma_transient_day_1_L1_log__`.ravel()[0] is NaN. The current approximation of RV `weekend_factor_hc_L2_log_raw_`.ravel()[0] is NaN. The current approximation of RV `weekend_factor_hc_L2_log_raw_`.ravel()[1] is NaN. The current approximation of RV `weekend_factor_hc_L2_log_raw_`.ravel()[2] is NaN. The current approximation of RV `weekend_factor_hc_L2_log_raw_`.ravel()[3] is NaN. The current approximation of RV `weekend_factor_hc_L2_log_raw_`.ravel()[4] is NaN. The current approximation of RV `weekend_factor_hc_L2_log_raw_`.ravel()[5] is NaN. The current approximation of RV `weekend_factor_hc_L2_log_raw_`.ravel()[6] is NaN. The current approximation of RV `weekend_factor_hc_L2_log_raw_`.ravel()[7] is NaN. The current approximation of RV `weekend_factor_hc_L2_log_raw_`.ravel()[8] is NaN. The current approximation of RV `weekend_factor_hc_L2_log_raw_`.ravel()[9] is NaN. The current approximation of RV `weekend_factor_hc_L2_log_raw_`.ravel()[10] is NaN. The current approximation of RV `weekend_factor_hc_L2_log_raw_`.ravel()[11] is NaN. The current approximation of RV `weekend_factor_hc_L2_log_raw_`.ravel()[12] is NaN. The current approximation of RV `weekend_factor_hc_L2_log_raw_`.ravel()[13] is NaN. The current approximation of RV `weekend_factor_hc_L2_log_raw_`.ravel()[14] is NaN. The current approximation of RV `weekend_factor_hc_L2_log_raw_`.ravel()[15] is NaN. The current approximation of RV `mu_log__`.ravel()[0] is NaN. Try tracking this parameter: http://docs.pymc.io/notebooks/variational_api_quickstart.html#Tracking-parameters
jdehning commented 4 years ago

Yes, the hierarchical models don't work very well. Probably the parametrization of the parameters could be done better. If you want, you could test whether it works if you remove the init parameter in pm.sample, such that it uses the default init method. Otherwise, you can use the example_one_bundesland, this one definitely works.