priesemann-group / covid19_inference Goto Github PK
View Code? Open in Web Editor NEWBayesian python toolbox for inference and forecast of the spread of the Coronavirus
License: GNU General Public License v3.0
Bayesian python toolbox for inference and forecast of the spread of the Coronavirus
License: GNU General Public License v3.0
There is (now?) a very cool dataset on testing around the world:
https://github.com/owid/covid-19-data/tree/master/public/data/testing
It is the data behind this other cool website on testing information:
https://ourworldindata.org/covid-testing
Since one of the aims in the future is to find ways to incorporate sampling corrections, a data_retrieval.testing() class would be useful.
This is a bit scrappier than usual because some data sources are daily, others weekly (e.g. Germany), and others in irregular intervals. There are also at least 4 types of testing data:
Probably what makes sense is to manually select which countries to ingest data, as building something robust enough for all would be difficult. Helper functions to add this data to other dataframes (e.g. JHU) would also be nice. Thoughts?
Why the values for the lambda_0, lambda_1, lambda_2, and lambda_3 negative. Aren't they supposed to be positive, at least in the initial stages when the number of cases is indeed increasing? I tried for Singapore and Itay and got similar results.
What am I missing here?
Hello good morning, I am writing a report of your model which is great, but I have a question about the posterior distributions of the parameters, is it the same as the a priori? Is there a way to know exactly the posterior distributions? Would it be helpful to me, please in which part of the model code do you multiply the a priori distribution with the maximum likelihood function?
I appreciate your help
@semohr or @pSpitzner Could you have a look at it? The notebook including the error message (cell number 10) is in master.
In the example for one region (Sachsen), the population of all of Germany is used N_population = 83e6
. Is this parameter important in the model, taking into account the forecasts obtained in this example?
When excecuting the covid19_inference/scripts/interactive/example_paper_scenarios.ipynb
on google colab (kaggle as well) I get the following error:
Auto-assigning NUTS sampler...
INFO [pymc3] Auto-assigning NUTS sampler...
Initializing NUTS using advi+adapt_diag...
INFO [pymc3] Initializing NUTS using advi+adapt_diag...
WARNING (theano.tensor.blas): We did not find a dynamic library in the library_dir of the library we use for blas. If you use ATLAS, make sure to compile it with dynamics library.
WARNING [theano.tensor.blas] We did not find a dynamic library in the library_dir of the library we use for blas. If you use ATLAS, make sure to compile it with dynamics library.
WARNING (theano.tensor.blas): We did not find a dynamic library in the library_dir of the library we use for blas. If you use ATLAS, make sure to compile it with dynamics library.
WARNING [theano.tensor.blas] We did not find a dynamic library in the library_dir of the library we use for blas. If you use ATLAS, make sure to compile it with dynamics library.
Average Loss = 777.63: 0%| | 386/200000 [00:01<16:12, 205.30it/s]
---------------------------------------------------------------------------
FloatingPointError Traceback (most recent call last)
<ipython-input-10-c20ebc4c3196> in <module>()
----> 1 trace = pm.sample(model=this_model, tune=500, draws=1000, init="advi+adapt_diag")
4 frames
/usr/local/lib/python3.7/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 `lambda_0_log_`.ravel()[0] is NaN.
The current approximation of RV `lambda_3_log_`.ravel()[0] is NaN.
The current approximation of RV `transient_day_3`.ravel()[0] is NaN.
The current approximation of RV `lambda_2_log_`.ravel()[0] is NaN.
The current approximation of RV `offset_modulation_rad_circular__`.ravel()[0] is NaN.
The current approximation of RV `weekend_factor_log`.ravel()[0] is NaN.
The current approximation of RV `delay_log`.ravel()[0] is NaN.
The current approximation of RV `transient_len_1_log_`.ravel()[0] is NaN.
The current approximation of RV `transient_day_1`.ravel()[0] is NaN.
The current approximation of RV `mu_log__`.ravel()[0] is NaN.
The current approximation of RV `transient_len_2_log_`.ravel()[0] is NaN.
The current approximation of RV `transient_len_3_log_`.ravel()[0] is NaN.
The current approximation of RV `I_begin_ratio_log`.ravel()[0] is NaN.
The current approximation of RV `lambda_1_log_`.ravel()[0] is NaN.
The current approximation of RV `transient_day_2`.ravel()[0] is NaN.
Try tracking this parameter: http://docs.pymc.io/notebooks/variational_api_quickstart.html#Tracking-parameters
in trace = pm.sample(model=this_model, tune=500, draws=1000, init="advi+adapt_diag")
Add the _SEIR_model_with_delay function in models from the previous repository to this one. Take the model.SIR in this repo as a template
A problem exists: "ERROR [pymc3] The rhat statistic is larger than 1.4 for some parameters. The sampler did not converge", when I run the PyMC3 sampleing using SEIR model. The problem as follow:
How to address the problem?
PS: The model have a larger number of parameters because more change points are set (8 change points). NUTS: [sigma_obs, delay_log, incub, I_begin, new_E_begin, mu, transient_len_7_log_, transient_len_6_log_, transient_len_5_log_, transient_len_4_log_, transient_len_3_log_, transient_len_2_log_, transient_len_1_log_, transient_day_7, transient_day_6, transient_day_5, transient_day_4, transient_day_3, transient_day_2, transient_day_1, lambda_7_log_, lambda_6_log_, lambda_5_log_, lambda_4_log_, lambda_3_log_, lambda_2_log_, lambda_1_log_, lambda_0_log_]
For windows users plotting functions do not work with default rcParams.
As one can see here Windows does not support %-d
. Which we use in our default rcParameters.
We have to change that or create a workaround for windows users.
Hello,
I'm trying to fetch data from JHU using the jhu class in data_retrival/_JHU.py. When I use the state argument in the methods get_new and get_total_confirmed_deaths_recovered, I get the error below. I've tried different formats for the state argument including: california, California, CA, CALIFORNIA, Calif., AZ, Arizona, Ariz.. I'm not sure what I'm missing, maybe someone can take a look.
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
2894 try:
-> 2895 return self._engine.get_loc(casted_key)
2896 except KeyError as err:
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
KeyError: 'CA'
The above exception was the direct cause of the following exception:
KeyError Traceback (most recent call last)
pandas/_libs/index.pyx in pandas._libs.index.BaseMultiIndexCodesEngine.get_loc()
5 frames
KeyError: 'CA'
During handling of the above exception, another exception occurred:
KeyError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/pandas/core/indexes/multi.py in get_loc(self, key, method)
2712
2713 if keylen == self.nlevels and self.is_unique:
-> 2714 return self._engine.get_loc(key)
2715
2716 # -- partial selection or non-unique index
pandas/_libs/index.pyx in pandas._libs.index.BaseMultiIndexCodesEngine.get_loc()
KeyError: ('US', 'CA')
Hi,
there is a small bug in the jupyter notebook "example_one_bundesland.ipynb" at the create model section. I guess the call needs to be changed as follows:
total_cases = rki.get_total(value="confirmed", bundesland="Sachsen",data_begin=bd, data_end=ed)
new_cases_obs = rki.get_new(value="confirmed", bundesland="Sachsen",data_begin=bd, data_end=ed)```
Best regards
Paulo
Probably because somewhere nans are appearing in the calculation
In order to automatize country analysis later on, we'll need to deal with the different ways countries are named in different sources. South Korea for instance is called "South Korea" (google), "Korea, South" (JHU) and "Republic of Korea" (apple). What about enforcing e.g. iso 3166 naming during download?
For a better performance, it could be usefull to sample with a full mass matrix, instead only of the diagonal. The newest not yet released version (3.9) of PyMC3 has it as option in pm.sample, but the different functions needed for it are already in earlier releases.
The goal would be to implement the sampling that works in PyMC 3.7 and 3.8 and test whether it is more performant (higher effective number of samples).
References to get started:
pymc-devs/pymc#3596
pymc-devs/pymc#3845
https://dfm.io/posts/pymc3-mass-matrix/
Currently the dependencies are not listed in setup.py, this should be fixed to make local development easier and allow for the later creation of a ci/cd pipeline
In order to parametrize better the hierarchical model, a non-centered parametrical distribution is better when the data is not very informative, see for example:
https://docs.pymc.io/notebooks/Diagnosing_biased_Inference_with_Divergences.html
or
https://pdfs.semanticscholar.org/7b85/fb48a077c679c325433fbe13b87560e12886.pdf
I implemented it for the normally distributed hierarchical variables (function model.hierarchical_normal), however it could be that a partial hierarchical parametrization is better from an sampling standpoint (see pdf above). Unsure whether it is worse digging deeper into it.
The script for the full SIR model runs perfectly. However, I am having a hard time implementing the simple SIR model and the SEIR model. Could you upload a script for those models?
I installed covid19_inference from pip as advised in the docs
All ran successfully (Windows 10, Python 3.8.2)
Initialize python and type
import covid19_inference
getting the error:
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\girar\AppData\Roaming\Python\Python38\site-packages\covid19_inference_init_.py", line 11, in
from . import data_retrieval
ImportError: cannot import name 'data_retrieval' from partially initialized module 'covid19_inference' (most likely due to a circular import) (C:\Users\girar\AppData\Roaming\Python\Python38\site-packages\covid19_inference_init_.py)
If I uninstall covid19_inference and import covid19_inference from the directory, the error does not happen
This error happens when running 1st cell in example_bundeslaender.ipynb with covid19_inference installed, but it does not happen when covid19_inference is not installed.
I just noticed that in the example notebook for one bundesland the offset in the timeseries_overview
figures seems to be broken.
The offset looked wrong to me so I tried to change the value in the function. Different values do not change the figures!
I could not find the bug in the corresponding functions i.e. _new_cases_to_cum_cases
. Maybe someone else can have a look at it.
Hi,
I am trying to run the the 'example_bundeslaender.ipynb', but i got 'ImportError: cannot import name 'data_retrieval''
I followed the instruction at https://covid19-inference.readthedocs.io/en/latest/doc/gettingstarted.html
Am I doing something wrong?
In PyMC3, stein variational gradient is already implemented, but it has to be tested how well it works/how biased it is for small number of particles. In addition, the optimal type of optimizer and learning rate has to found out. Eventually it could be tried to reparametrize the model, to get a simpler posterior
Reference for the bias: https://ferrine.github.io/blog/2017/06/04/asvgd-sanity-check/
The example notebooks are not working because there is some problem with the datetime object. I pushed the failing notebooks including the error message
@semohr Could you look at it?
The data retrieved using the JHU class by e.g. get_confirmed is differently formatted. If it is converted to a numpy array, it is [[2], [4],...] instead of [2,4,...], i.e. apparently an array of arrays.
Since we always use the full RKI dataset, it is faster to download the data one-shot instead of by Landkreise. The RKI now offers that: https://www.arcgis.com/sharing/rest/content/items/f10774f1c63e40168479a1feb6c7ca74/data
This fixes an issue:
But creates another:
We could use first try the csv, then fall back to the api if it fails.
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")
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) <ipython-input-12-4c9e4de60d32> in <module>() ----> 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
Possible plots:
- For one variable: the name of the regions as y axis, x-axis are CI intervals
- For each region, table of histograms, one histogram/pdf per variable, like in the paper, eventually up to 3 regions per figures
Hello. It is difficult to understand the description of the delay_cases
function parameters.
def delay_cases(
new_I_t,
pr_median_delay=10,
pr_sigma_median_delay=0.2,
pr_median_scale_delay=0.3,
pr_sigma_scale_delay=None,
...
):
Perhaps refactoring is needed here:
pr_median_delay : float
The prior of the median delay [The prior for the median of the median delay distribution?]
scale_delay [pr_median_scale_delay?] : float
The scale of the delay, that is how wide the distribution is [?].
pr_sigma_median_delay : float
The prior for the sigma of the median delay distribution.
[pr_sigma_scale_delay?]
Is the formula for y_delayed
in the documentation correct?
Add a pre-commit hook to format submitted code with black
Make the data_retrieval module consistent:
- data is retrieved with get_* with * being something like rki or jhu
- it is then filtered with different functions to get the data that one wants. These functions should be named filter_* and should all accept two datetime.datetime objects as begin and end of the data one wants. It should return a pandas dataframe with as index datetime.datetime objects and as column the different regions/countries
Excuses me to put this โ in your issue timeline:
seems it is the nearest place to find it:
from 6/2020 on german newspaper "Morgenpost" daily the precise data given from every "station" in germany to the divi - register were available as public json record. Since end of 4/2020 it stops. no updates anymore.
Somebody has noticed it?
May be a new url?
Excuse me again ๐ฎโ๐จ
there are some small syntax errors in country anlaysis, theses should be fixed
I could not plot distributions for a model that I specified its name...
# the covid19_inference/plot.py needs to be refactored to accommodate this
# Error log below
"""
KeyError Traceback (most recent call last)
<ipython-input-309-983232f0c631> in <module>()
----> 1 plot_distributions(model=this_model,model_trace=model1, color='b')
2 frames
<ipython-input-308-056ce75e6fe4> in plot_distributions(model_trace, model, color)
33
34 for idx, var in enumerate(left_column):
---> 35 cov19.plot._distribution(model, model_trace, var, ax=axes[idx, 0], color=color)
36
37 for idx, var in enumerate(mid_column):
/usr/local/lib/python3.6/dist-packages/covid19_inference/plot.py in _distribution(model, trace, key, ax, color, draw_prior)
767 if "lambda" in key or "mu" == key:
768 ax.set_xlim(0, 0.5)
--> 769 ax.axvline(np.median(trace["mu"]), ls=":", color="black")
770 elif "I_begin" == key:
771 ax.set_xlim(0)
/usr/local/lib/python3.6/dist-packages/pymc3/backends/base.py in __getitem__(self, idx)
317 if var in self.stat_names:
318 return self.get_sampler_stats(var, burn=burn, thin=thin)
--> 319 raise KeyError("Unknown variable %s" % var)
320
321 _attrs = set(['_straces', 'varnames', 'chains', 'stat_names',
KeyError: 'Unknown variable mu'
"""
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.