{"action":"created","issue":{"url":"https://api.github.com/repos/pgmpy/pgmpy/issues/452","labels_url":"https://api.github.com/repos/pgmpy/pgmpy/issues/452/labels{/name}","comments_url":"https://api.github.com/repos/pgmpy/pgmpy/issues/452/comments","events_url":"https://api.github.com/repos/pgmpy/pgmpy/issues/452/events","html_url":"https://github.com/pgmpy/pgmpy/issues/452","id":96626623,"number":452,"title":"Dynamic Bayesian Network bug ","user":{"login":"palashahuja","id":8504351,"avatar_url":"https://avatars.githubusercontent.com/u/8504351?v=3","gravatar_id":"","url":"https://api.github.com/users/palashahuja","html_url":"https://github.com/palashahuja","followers_url":"https://api.github.com/users/palashahuja/followers","following_url":"https://api.github.com/users/palashahuja/following{/other_user}","gists_url":"https://api.github.com/users/palashahuja/gists{/gist_id}","starred_url":"https://api.github.com/users/palashahuja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palashahuja/subscriptions","organizations_url":"https://api.github.com/users/palashahuja/orgs","repos_url":"https://api.github.com/users/palashahuja/repos","events_url":"https://api.github.com/users/palashahuja/events{/privacy}","received_events_url":"https://api.github.com/users/palashahuja/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-07-22T17:51:50Z","updated_at":"2015-12-25T20:19:53Z","closed_at":null,"body":"```\r\nfrom pgmpy.models import DynamicBayesianNetwork as dbn\r\nfrom pgmpy.factors import TabularCPD\r\nimport numpy as np\r\nmodel = dbn()\r\nmodel.add_edges_from([(('a',0),('b',1)),(('c',0),('b',1))])\r\nvalues = np.split(np.random.rand(4),2)\r\na_cpd = TabularCPD(('b',1), 2, values, [('a',0)], 2)\r\nc_cpd = TabularCPD(('b',1), 2, values, [('c',0)], 2)\r\nmodel.add_cpds(a_cpd, c_cpd)\r\nmodel.initialize_initial_state()\r\n```"},"comment":{"url":"https://api.github.com/repos/pgmpy/pgmpy/issues/comments/167261088","html_url":"https://github.com/pgmpy/pgmpy/issues/452#issuecomment-167261088","issue_url":"https://api.github.com/repos/pgmpy/pgmpy/issues/452","id":167261088,"user":{"login":"khalibartan","id":8940456,"avatar_url":"https://avatars.githubusercontent.com/u/8940456?v=3","gravatar_id":"","url":"https://api.github.com/users/khalibartan","html_url":"https://github.com/khalibartan","followers_url":"https://api.github.com/users/khalibartan/followers","following_url":"https://api.github.com/users/khalibartan/following{/other_user}","gists_url":"https://api.github.com/users/khalibartan/gists{/gist_id}","starred_url":"https://api.github.com/users/khalibartan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khalibartan/subscriptions","organizations_url":"https://api.github.com/users/khalibartan/orgs","repos_url":"https://api.github.com/users/khalibartan/repos","events_url":"https://api.github.com/users/khalibartan/events{/privacy}","received_events_url":"https://api.github.com/users/khalibartan/received_events","type":"User","site_admin":false},"created_at":"2015-12-25T20:19:53Z","updated_at":"2015-12-25T20:19:53Z","body":"@palashahuja TabularCPD of ('G',0) clearly doesn't sums upto one. Bug would have been caused .\r\nHere is the corrected one\r\n```\r\n        >>> from pgmpy.models import DynamicBayesianNetwork as DBN\r\n        >>> from pgmpy.factors import TabularCPD\r\n        >>> student = DBN()\r\n        >>> student.add_nodes_from(['D', 'G', 'I', 'S', 'L'])\r\n        >>> student.add_edges_from([(('D', 0),('G', 0)),(('I', 0),('G', 0)),(('D', 0),('D', 1)),(('I', 0),('I', 1))])\r\n        >>> grade_cpd = TabularCPD(('G', 0), 3, [[0.3, 0.05, 0.9, 0.5],\r\n        ...                                      [0.4, 0.25, 0.08, 0.3],\r\n        ...                                      [0.3, 0.7, 0.02, 0.2]],\r\n        ...                        evidence=[('I', 0),('D', 0)],\r\n        ...                        evidence_card=[2, 2])\r\n        >>> d_i_cpd = TabularCPD(('D', 1), 2, [[0.6, 0.3],\r\n        ...                                    [0.4, 0.7]],\r\n        ...                      evidence=[('D', 0)],\r\n        ...                      evidence_card=2)\r\n        >>> diff_cpd = TabularCPD(('D', 0), 2, [[0.6, 0.4]])\r\n        >>> intel_cpd = TabularCPD(('I',0), 2, [[0.7, 0.3]])\r\n        >>> i_i_cpd = TabularCPD(('I', 1), 2, [[0.5, 0.4],\r\n        ...                                    [0.5, 0.6]],\r\n        ...                      evidence=[('I', 0)],\r\n        ...                      evidence_card=2)\r\n        >>> student.add_cpds(grade_cpd, d_i_cpd, diff_cpd, intel_cpd, i_i_cpd)\r\n        >>> student.initialize_initial_state()\r\n```"}}