{"action":"created","issue":{"url":"https://api.github.com/repos/bayespy/bayespy/issues/48","repository_url":"https://api.github.com/repos/bayespy/bayespy","labels_url":"https://api.github.com/repos/bayespy/bayespy/issues/48/labels{/name}","comments_url":"https://api.github.com/repos/bayespy/bayespy/issues/48/comments","events_url":"https://api.github.com/repos/bayespy/bayespy/issues/48/events","html_url":"https://github.com/bayespy/bayespy/issues/48","id":125950972,"number":48,"title":"Potential bug in Mixture","user":{"login":"viveksck","id":335394,"avatar_url":"https://avatars.githubusercontent.com/u/335394?v=3","gravatar_id":"","url":"https://api.github.com/users/viveksck","html_url":"https://github.com/viveksck","followers_url":"https://api.github.com/users/viveksck/followers","following_url":"https://api.github.com/users/viveksck/following{/other_user}","gists_url":"https://api.github.com/users/viveksck/gists{/gist_id}","starred_url":"https://api.github.com/users/viveksck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/viveksck/subscriptions","organizations_url":"https://api.github.com/users/viveksck/orgs","repos_url":"https://api.github.com/users/viveksck/repos","events_url":"https://api.github.com/users/viveksck/events{/privacy}","received_events_url":"https://api.github.com/users/viveksck/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-11T14:06:00Z","updated_at":"2016-02-03T06:53:01Z","closed_at":null,"body":"I am trying to implement a simple mixture of Categorical Distributions where\r\nWhen p = 0 I need [0,0] \r\nand when p = 1 I need [1,1] \r\n\r\nThis can easily be achieved through a mixture model as follows: Component Distribution when p =0 should be Categorical([[1,0],[1,0]]) and Component Distribution when p = 1 should be Categorical([[0,1],[0,1]])\r\n\r\np is the selector which is Categorical([0.5,0.5])\r\n\r\nHowever this simple example does not work. It generates a sample [0,1] which should never occurr. \r\n\r\nI have verified that individual components generate the right samples. Just trying to use Mixture to select each component however does not work.\r\n.\r\n```python\r\nfrom bayespy.nodes import Categorical, Mixture\r\nfrom collections import Counter\r\np = Categorical([0.5,0.5])\r\n\r\nX = np.array([[[0.999,0.001],[0.999,0.001]],[[0.001,0.999],[0.001,0.999]]])\r\n\r\nz.random()\r\nOutput: array([0, 1]) << We should never actually see (0,1) because when we select a component it should only either yield [0,0] or [1,1]\r\n\r\nq = Categorical(X[0], plates=(1000,2))  << This works only [0,0] should be returned\r\narray([[0, 0],\r\n       [0, 0],\r\n       [0, 0],\r\n       ..., \r\n       [0, 0],\r\n       [0, 0],\r\n       [0, 0]])\r\n\r\nSimilarly X[1] Categorical(X[1], plates=(1000,2)) only returns [1,1]\r\n"},"comment":{"url":"https://api.github.com/repos/bayespy/bayespy/issues/comments/179049599","html_url":"https://github.com/bayespy/bayespy/issues/48#issuecomment-179049599","issue_url":"https://api.github.com/repos/bayespy/bayespy/issues/48","id":179049599,"user":{"login":"jluttine","id":2195834,"avatar_url":"https://avatars.githubusercontent.com/u/2195834?v=3","gravatar_id":"","url":"https://api.github.com/users/jluttine","html_url":"https://github.com/jluttine","followers_url":"https://api.github.com/users/jluttine/followers","following_url":"https://api.github.com/users/jluttine/following{/other_user}","gists_url":"https://api.github.com/users/jluttine/gists{/gist_id}","starred_url":"https://api.github.com/users/jluttine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jluttine/subscriptions","organizations_url":"https://api.github.com/users/jluttine/orgs","repos_url":"https://api.github.com/users/jluttine/repos","events_url":"https://api.github.com/users/jluttine/events{/privacy}","received_events_url":"https://api.github.com/users/jluttine/received_events","type":"User","site_admin":false},"created_at":"2016-02-03T06:53:01Z","updated_at":"2016-02-03T06:53:01Z","body":"Was this problem solved (i.e., did my answer explain the weird things you saw) or could you provide a simple example to reproduce the bug at some point so I could take a look?"}}