Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save AustinRochford/62c283a3f0fae90b5e39 to your computer and use it in GitHub Desktop.
Save AustinRochford/62c283a3f0fae90b5e39 to your computer and use it in GitHub Desktop.
Density Estimation with Dirichlet Process Mixtures using PyMC3
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wuciawe
Copy link

wuciawe commented Jul 14, 2017

Hi, thanks to this great post. I find that ElemwiseCategoricalStep doesn't exist in pymc3 any more, so I replace it with ElemwiseCategorical, and keep everything else the same as in the post, but I failed to obatin the expected result in estimate the density of waiting times between eruptions. The result of the estimated density looks like a single modal gaussian.

EDIT:

I find the reason, there are some typos in the post:

  1. In [24]: 1. / np.sqrt(trace['lambda'] * trace['tau'])[:, np.newaxis, :]) should be (trace['lambda'] * trace['tau'])[:, np.newaxis, :], there should be no inverse and square root.
  2. In the example of estimate the density of sunspots per year, multiple occurance of trace['beta'] should be trace['w'] and In [30]: w = pm.Deterministic('beta', beta * T.concatenate([[1], T.extra_ops.cumprod(1 - beta[:-1])])) should be w = pm.Deterministic('w', beta * T.concatenate([[1], T.extra_ops.cumprod(1 - beta[:-1])]))

I don't understand why in the second case, reassign beta variable does not raise an error in pymc3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment