{"action":"created","issue":{"url":"https://api.github.com/repos/pymc-devs/pymc3/issues/443","labels_url":"https://api.github.com/repos/pymc-devs/pymc3/issues/443/labels{/name}","comments_url":"https://api.github.com/repos/pymc-devs/pymc3/issues/443/comments","events_url":"https://api.github.com/repos/pymc-devs/pymc3/issues/443/events","html_url":"https://github.com/pymc-devs/pymc3/issues/443","id":25037593,"number":443,"title":"Mixture Modeling example not working in pymc3","user":{"login":"zaxtax","id":8529,"avatar_url":"https://avatars.githubusercontent.com/u/8529?v=3","gravatar_id":"","url":"https://api.github.com/users/zaxtax","html_url":"https://github.com/zaxtax","followers_url":"https://api.github.com/users/zaxtax/followers","following_url":"https://api.github.com/users/zaxtax/following{/other_user}","gists_url":"https://api.github.com/users/zaxtax/gists{/gist_id}","starred_url":"https://api.github.com/users/zaxtax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zaxtax/subscriptions","organizations_url":"https://api.github.com/users/zaxtax/orgs","repos_url":"https://api.github.com/users/zaxtax/repos","events_url":"https://api.github.com/users/zaxtax/events{/privacy}","received_events_url":"https://api.github.com/users/zaxtax/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":21,"created_at":"2014-01-03T21:42:33Z","updated_at":"2015-05-26T06:30:16Z","closed_at":null,"body":"I am trying to port the mixture model to pymc3, but running into problem\r\n\r\nhttps://gist.github.com/zaxtax/7968670\r\n\r\nI get the following error as present\r\n\r\n  File \"finite_mixture.py\", line 21, in <module>\r\n    shape=ndata)\r\n  File \"/usr/local/lib/python2.7/dist-packages/pymc-3.0-py2.7.egg/pymc/distributions/distribution.py\", line 19, in __new__\r\n    return model.Var(name, dist, data)\r\n  File \"/usr/local/lib/python2.7/dist-packages/pymc-3.0-py2.7.egg/pymc/model.py\", line 144, in Var\r\n    var = FreeRV(name=name, distribution=dist, model=self) \r\n  File \"/usr/local/lib/python2.7/dist-packages/pymc-3.0-py2.7.egg/pymc/model.py\", line 328, in __init__\r\n    distribution.shape, distribution.dtype) * distribution.default()\r\nValueError: operands could not be broadcast together with shapes (500) (3) \r\n\r\nIf I replace Multinomial with Categorical I get\r\n\r\nTraceback (most recent call last):\r\n  File \"finite_mixture.py\", line 27, in <module>\r\n    tr = sample(3000, step=Metropolis(model.vars))\r\n  File \"/usr/local/lib/python2.7/dist-packages/pymc-3.0-py2.7.egg/pymc/sample.py\", line 48, in sample\r\n    random_seed=random_seed)):\r\n  File \"/usr/local/lib/python2.7/dist-packages/pymc-3.0-py2.7.egg/pymc/sample.py\", line 118, in iter_sample\r\n    point = step.step(point)\r\n  File \"/usr/local/lib/python2.7/dist-packages/pymc-3.0-py2.7.egg/pymc/step_methods/arraystep.py\", line 24, in step\r\n    apoint = self.astep(bij.map(point), *inputs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/pymc-3.0-py2.7.egg/pymc/step_methods/metropolis.py\", line 105, in astep\r\n    q_new = metrop_select(logp(q) - logp(q0), q, q0)\r\n  File \"/usr/local/lib/python2.7/dist-packages/pymc-3.0-py2.7.egg/pymc/blocking.py\", line 119, in __call__\r\n    return self.fa(self.fb(x))\r\n  File \"/usr/local/lib/python2.7/dist-packages/pymc-3.0-py2.7.egg/pymc/model.py\", line 290, in __call__\r\n    return self.f(**state)\r\n  File \"/usr/local/lib/python2.7/dist-packages/theano/compile/function_module.py\", line 588, in __call__\r\n    self.fn.thunks[self.fn.position_of_error])\r\n  File \"/usr/local/lib/python2.7/dist-packages/theano/compile/function_module.py\", line 579, in __call__\r\n    outputs = self.fn()\r\nIndexError: index 3 is out of bounds for size 3\r\nApply node that caused the error: AdvancedSubtensor1(dd, category)\r\nInputs shapes: [(3,), (500,)]\r\nInputs strides: [(8,), (8,)]\r\nInputs types: [TensorType(float64, vector), TensorType(int64, vector)]\r\nUse the Theano flag 'exception_verbosity=high' for a debugprint of this apply node.\r\n"},"comment":{"url":"https://api.github.com/repos/pymc-devs/pymc3/issues/comments/105415116","html_url":"https://github.com/pymc-devs/pymc3/issues/443#issuecomment-105415116","issue_url":"https://api.github.com/repos/pymc-devs/pymc3/issues/443","id":105415116,"user":{"login":"twiecki","id":674200,"avatar_url":"https://avatars.githubusercontent.com/u/674200?v=3","gravatar_id":"","url":"https://api.github.com/users/twiecki","html_url":"https://github.com/twiecki","followers_url":"https://api.github.com/users/twiecki/followers","following_url":"https://api.github.com/users/twiecki/following{/other_user}","gists_url":"https://api.github.com/users/twiecki/gists{/gist_id}","starred_url":"https://api.github.com/users/twiecki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twiecki/subscriptions","organizations_url":"https://api.github.com/users/twiecki/orgs","repos_url":"https://api.github.com/users/twiecki/repos","events_url":"https://api.github.com/users/twiecki/events{/privacy}","received_events_url":"https://api.github.com/users/twiecki/received_events","type":"User","site_admin":false},"created_at":"2015-05-26T06:30:16Z","updated_at":"2015-05-26T06:30:16Z","body":"Unfortunately, even after fixing the nan issue, the model does not seem to work as no Metropolis step is ever accepted."}}