{"action":"created","issue":{"url":"https://api.github.com/repos/pymc-devs/pymc3/issues/2880","repository_url":"https://api.github.com/repos/pymc-devs/pymc3","labels_url":"https://api.github.com/repos/pymc-devs/pymc3/issues/2880/labels{/name}","comments_url":"https://api.github.com/repos/pymc-devs/pymc3/issues/2880/comments","events_url":"https://api.github.com/repos/pymc-devs/pymc3/issues/2880/events","html_url":"https://github.com/pymc-devs/pymc3/issues/2880","id":301735989,"number":2880,"title":"KeyError: 'chol_cov_cholesky_cov'","user":{"login":"janboone","id":1701497,"avatar_url":"https://avatars3.githubusercontent.com/u/1701497?v=4","gravatar_id":"","url":"https://api.github.com/users/janboone","html_url":"https://github.com/janboone","followers_url":"https://api.github.com/users/janboone/followers","following_url":"https://api.github.com/users/janboone/following{/other_user}","gists_url":"https://api.github.com/users/janboone/gists{/gist_id}","starred_url":"https://api.github.com/users/janboone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janboone/subscriptions","organizations_url":"https://api.github.com/users/janboone/orgs","repos_url":"https://api.github.com/users/janboone/repos","events_url":"https://api.github.com/users/janboone/events{/privacy}","received_events_url":"https://api.github.com/users/janboone/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-03-02T11:26:21Z","updated_at":"2018-03-02T11:33:26Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\n\r\nRunning the example from [here](https://twiecki.github.io/blog/2017/07/05/new-in-pymc3-31/)\r\n\r\n\r\n\r\n```\r\nn_dim = 5\r\ndata = np.random.randn(100, n_dim)\r\nwith pm.Model() as model:\r\n    # Note that we access the distribution for the standard\r\n    # deviations, and do not create a new random variable.\r\n    sd_dist = pm.HalfCauchy.dist(beta=2.5)\r\n    packed_chol = pm.LKJCholeskyCov('chol_cov', eta=2, n=n_dim, \r\n    sd_dist=sd_dist)\r\n    chol = pm.expand_packed_triangular(n_dim, packed_chol, lower=True)\r\n    # Define a new MvNormal with the given covariance\r\n    vals = pm.MvNormal('vals', mu=np.zeros(n_dim), \r\n      chol=chol, shape=n_dim,\r\n      observed=data)\r\n    trace = pm.sample()\r\n```\r\n\r\n\r\nYields the error: KeyError: 'chol_cov_cholesky_cov'\r\n\r\n\r\n## Versions and main components\r\n\r\nPython 3.6.3\r\nIPython 6.1.0\r\nPyMC3 3.3\r\nNumPy 1.13.3\r\nSciPy 0.19.1\r\nMatplotlib 2.1.0\r\n* How did you install PyMC3: pip\r\n"},"comment":{"url":"https://api.github.com/repos/pymc-devs/pymc3/issues/comments/369898104","html_url":"https://github.com/pymc-devs/pymc3/issues/2880#issuecomment-369898104","issue_url":"https://api.github.com/repos/pymc-devs/pymc3/issues/2880","id":369898104,"user":{"login":"janboone","id":1701497,"avatar_url":"https://avatars3.githubusercontent.com/u/1701497?v=4","gravatar_id":"","url":"https://api.github.com/users/janboone","html_url":"https://github.com/janboone","followers_url":"https://api.github.com/users/janboone/followers","following_url":"https://api.github.com/users/janboone/following{/other_user}","gists_url":"https://api.github.com/users/janboone/gists{/gist_id}","starred_url":"https://api.github.com/users/janboone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janboone/subscriptions","organizations_url":"https://api.github.com/users/janboone/orgs","repos_url":"https://api.github.com/users/janboone/repos","events_url":"https://api.github.com/users/janboone/events{/privacy}","received_events_url":"https://api.github.com/users/janboone/received_events","type":"User","site_admin":false},"created_at":"2018-03-02T11:33:26Z","updated_at":"2018-03-02T11:33:26Z","author_association":"NONE","body":"Sure, no problem. Thanks a lot for looking into this. I am running this on a macbook.\r\n\r\n```\r\nKeyError                                  Traceback (most recent call last)\r\n<ipython-input-12-93a020fece22> in <module>()\r\n     14                        chol=chol, shape=n_dim,\r\n     15                        observed=data)\r\n---> 16     trace = pm.sample()\r\n\r\n~/anaconda3/lib/python3.6/site-packages/pymc3/sampling.py in sample(draws, step, init, n_init, start, trace, chain_idx, chains, cores, tune, nuts_kwargs, step_kwargs, progressbar, model, random_seed, live_plot, discard_tuned_samples, live_plot_kwargs, compute_convergence_checks, **kwargs)\r\n    461 \r\n    462     if compute_convergence_checks:\r\n--> 463         trace.report._run_convergence_checks(trace, model)\r\n    464 \r\n    465     trace.report._log_summary()\r\n\r\n~/anaconda3/lib/python3.6/site-packages/pymc3/backends/report.py in _run_convergence_checks(self, trace, model)\r\n     78             varnames.append(rv_name)\r\n     79 \r\n---> 80         self._effective_n = effective_n = diagnostics.effective_n(trace, varnames)\r\n     81         self._gelman_rubin = gelman_rubin = diagnostics.gelman_rubin(trace, varnames)\r\n     82 \r\n\r\n~/anaconda3/lib/python3.6/site-packages/pymc3/diagnostics.py in effective_n(mtrace, varnames, include_transformed)\r\n    298 \r\n    299     for var in varnames:\r\n--> 300         n_eff[var] = generate_neff(mtrace.get_values(var, combine=False))\r\n    301 \r\n    302     return n_eff\r\n\r\n~/anaconda3/lib/python3.6/site-packages/pymc3/backends/base.py in get_values(self, varname, burn, thin, combine, chains, squeeze)\r\n    426         try:\r\n    427             results = [self._straces[chain].get_values(varname, burn, thin)\r\n--> 428                        for chain in chains]\r\n    429         except TypeError:  # Single chain passed.\r\n    430             results = [self._straces[chains].get_values(varname, burn, thin)]\r\n\r\n~/anaconda3/lib/python3.6/site-packages/pymc3/backends/base.py in <listcomp>(.0)\r\n    426         try:\r\n    427             results = [self._straces[chain].get_values(varname, burn, thin)\r\n--> 428                        for chain in chains]\r\n    429         except TypeError:  # Single chain passed.\r\n    430             results = [self._straces[chains].get_values(varname, burn, thin)]\r\n\r\n~/anaconda3/lib/python3.6/site-packages/pymc3/backends/ndarray.py in get_values(self, varname, burn, thin)\r\n    141         A NumPy array\r\n    142         \"\"\"\r\n--> 143         return self.samples[varname][burn::thin]\r\n    144 \r\n    145     def _slice(self, idx):\r\n\r\nKeyError: 'chol_cov_cholesky_cov'\r\n```"}}
{"actor":{"display_login":"janboone"}}