{"action":"opened","number":694,"pull_request":{"url":"https://api.github.com/repos/pgmpy/pgmpy/pulls/694","id":72066798,"html_url":"https://github.com/pgmpy/pgmpy/pull/694","diff_url":"https://github.com/pgmpy/pgmpy/pull/694.diff","patch_url":"https://github.com/pgmpy/pgmpy/pull/694.patch","issue_url":"https://api.github.com/repos/pgmpy/pgmpy/issues/694","number":694,"state":"open","locked":false,"title":"Refactor MLE.py/BaseEstimator.py","user":{"login":"chrisittner","id":2837099,"avatar_url":"https://avatars.githubusercontent.com/u/2837099?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisittner","html_url":"https://github.com/chrisittner","followers_url":"https://api.github.com/users/chrisittner/followers","following_url":"https://api.github.com/users/chrisittner/following{/other_user}","gists_url":"https://api.github.com/users/chrisittner/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisittner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisittner/subscriptions","organizations_url":"https://api.github.com/users/chrisittner/orgs","repos_url":"https://api.github.com/users/chrisittner/repos","events_url":"https://api.github.com/users/chrisittner/events{/privacy}","received_events_url":"https://api.github.com/users/chrisittner/received_events","type":"User","site_admin":false},"body":"3 commits:\r\n\r\n1. cleaned code in `get_parameters` a bit, added internal `_estimate_cpd` method, because estimation is done node-by-node.\r\n\r\n2. Allow to pass an optional list/set of possible values for each node in `BaseEstimator`, to deal with cases where not all values, that a variable may have, occur in the data set.\r\n\r\n3. Make use of the `state_name` feature of CPDs for values taken from the data set:\r\n```python\r\nimport pandas as pd\r\nfrom pgmpy.models import BayesianModel\r\nfrom pgmpy.estimators import MaximumLikelihoodEstimator\r\nmle=MaximumLikelihoodEstimator(BayesianModel([('A','B')]), \r\n                               pd.DataFrame(data={'A':[1, 2], 'B':[23, 42]}))\r\nprint(str(mle.get_parameters()[0]))\r\n```\r\nOutput before:\r\n```\r\n╒═════╤═════╤═════╕\r\n│ A   │ A_0 │ A_1 │\r\n├─────┼─────┼─────┤\r\n│ B_0 │ 1.0 │ 0.0 │\r\n├─────┼─────┼─────┤\r\n│ B_1 │ 0.0 │ 1.0 │\r\n╘═════╧═════╧═════╛\r\n```\r\nOutput now:\r\n```\r\n╒═══════╤══════╤══════╕\r\n│ A     │ A(1) │ A(2) │\r\n├───────┼──────┼──────┤\r\n│ B(23) │ 1.0  │ 0.0  │\r\n├───────┼──────┼──────┤\r\n│ B(42) │ 0.0  │ 1.0  │\r\n╘═══════╧══════╧══════╛\r\n```","created_at":"2016-05-31T18:52:07Z","updated_at":"2016-05-31T18:52:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pgmpy/pgmpy/pulls/694/commits","review_comments_url":"https://api.github.com/repos/pgmpy/pgmpy/pulls/694/comments","review_comment_url":"https://api.github.com/repos/pgmpy/pgmpy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pgmpy/pgmpy/issues/694/comments","statuses_url":"https://api.github.com/repos/pgmpy/pgmpy/statuses/a322652e5b6e1fc5bab605d5042e10553e5a3931","head":{"label":"chrisittner:refactor_MLE","ref":"refactor_MLE","sha":"a322652e5b6e1fc5bab605d5042e10553e5a3931","user":{"login":"chrisittner","id":2837099,"avatar_url":"https://avatars.githubusercontent.com/u/2837099?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisittner","html_url":"https://github.com/chrisittner","followers_url":"https://api.github.com/users/chrisittner/followers","following_url":"https://api.github.com/users/chrisittner/following{/other_user}","gists_url":"https://api.github.com/users/chrisittner/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisittner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisittner/subscriptions","organizations_url":"https://api.github.com/users/chrisittner/orgs","repos_url":"https://api.github.com/users/chrisittner/repos","events_url":"https://api.github.com/users/chrisittner/events{/privacy}","received_events_url":"https://api.github.com/users/chrisittner/received_events","type":"User","site_admin":false},"repo":{"id":51729857,"name":"pgmpy","full_name":"chrisittner/pgmpy","owner":{"login":"chrisittner","id":2837099,"avatar_url":"https://avatars.githubusercontent.com/u/2837099?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisittner","html_url":"https://github.com/chrisittner","followers_url":"https://api.github.com/users/chrisittner/followers","following_url":"https://api.github.com/users/chrisittner/following{/other_user}","gists_url":"https://api.github.com/users/chrisittner/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisittner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisittner/subscriptions","organizations_url":"https://api.github.com/users/chrisittner/orgs","repos_url":"https://api.github.com/users/chrisittner/repos","events_url":"https://api.github.com/users/chrisittner/events{/privacy}","received_events_url":"https://api.github.com/users/chrisittner/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chrisittner/pgmpy","description":"Python Library for Probabilistic Graphical Models","fork":true,"url":"https://api.github.com/repos/chrisittner/pgmpy","forks_url":"https://api.github.com/repos/chrisittner/pgmpy/forks","keys_url":"https://api.github.com/repos/chrisittner/pgmpy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chrisittner/pgmpy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chrisittner/pgmpy/teams","hooks_url":"https://api.github.com/repos/chrisittner/pgmpy/hooks","issue_events_url":"https://api.github.com/repos/chrisittner/pgmpy/issues/events{/number}","events_url":"https://api.github.com/repos/chrisittner/pgmpy/events","assignees_url":"https://api.github.com/repos/chrisittner/pgmpy/assignees{/user}","branches_url":"https://api.github.com/repos/chrisittner/pgmpy/branches{/branch}","tags_url":"https://api.github.com/repos/chrisittner/pgmpy/tags","blobs_url":"https://api.github.com/repos/chrisittner/pgmpy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chrisittner/pgmpy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chrisittner/pgmpy/git/refs{/sha}","trees_url":"https://api.github.com/repos/chrisittner/pgmpy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chrisittner/pgmpy/statuses/{sha}","languages_url":"https://api.github.com/repos/chrisittner/pgmpy/languages","stargazers_url":"https://api.github.com/repos/chrisittner/pgmpy/stargazers","contributors_url":"https://api.github.com/repos/chrisittner/pgmpy/contributors","subscribers_url":"https://api.github.com/repos/chrisittner/pgmpy/subscribers","subscription_url":"https://api.github.com/repos/chrisittner/pgmpy/subscription","commits_url":"https://api.github.com/repos/chrisittner/pgmpy/commits{/sha}","git_commits_url":"https://api.github.com/repos/chrisittner/pgmpy/git/commits{/sha}","comments_url":"https://api.github.com/repos/chrisittner/pgmpy/comments{/number}","issue_comment_url":"https://api.github.com/repos/chrisittner/pgmpy/issues/comments{/number}","contents_url":"https://api.github.com/repos/chrisittner/pgmpy/contents/{+path}","compare_url":"https://api.github.com/repos/chrisittner/pgmpy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chrisittner/pgmpy/merges","archive_url":"https://api.github.com/repos/chrisittner/pgmpy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chrisittner/pgmpy/downloads","issues_url":"https://api.github.com/repos/chrisittner/pgmpy/issues{/number}","pulls_url":"https://api.github.com/repos/chrisittner/pgmpy/pulls{/number}","milestones_url":"https://api.github.com/repos/chrisittner/pgmpy/milestones{/number}","notifications_url":"https://api.github.com/repos/chrisittner/pgmpy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chrisittner/pgmpy/labels{/name}","releases_url":"https://api.github.com/repos/chrisittner/pgmpy/releases{/id}","deployments_url":"https://api.github.com/repos/chrisittner/pgmpy/deployments","created_at":"2016-02-15T04:03:47Z","updated_at":"2016-02-15T04:03:48Z","pushed_at":"2016-05-31T18:51:18Z","git_url":"git://github.com/chrisittner/pgmpy.git","ssh_url":"git@github.com:chrisittner/pgmpy.git","clone_url":"https://github.com/chrisittner/pgmpy.git","svn_url":"https://github.com/chrisittner/pgmpy","homepage":null,"size":4968,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"dev"}},"base":{"label":"pgmpy:dev","ref":"dev","sha":"c9bc0e2e7b2f529229b86f76639dbfefc54adf2a","user":{"login":"pgmpy","id":5500131,"avatar_url":"https://avatars.githubusercontent.com/u/5500131?v=3","gravatar_id":"","url":"https://api.github.com/users/pgmpy","html_url":"https://github.com/pgmpy","followers_url":"https://api.github.com/users/pgmpy/followers","following_url":"https://api.github.com/users/pgmpy/following{/other_user}","gists_url":"https://api.github.com/users/pgmpy/gists{/gist_id}","starred_url":"https://api.github.com/users/pgmpy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pgmpy/subscriptions","organizations_url":"https://api.github.com/users/pgmpy/orgs","repos_url":"https://api.github.com/users/pgmpy/repos","events_url":"https://api.github.com/users/pgmpy/events{/privacy}","received_events_url":"https://api.github.com/users/pgmpy/received_events","type":"Organization","site_admin":false},"repo":{"id":12968651,"name":"pgmpy","full_name":"pgmpy/pgmpy","owner":{"login":"pgmpy","id":5500131,"avatar_url":"https://avatars.githubusercontent.com/u/5500131?v=3","gravatar_id":"","url":"https://api.github.com/users/pgmpy","html_url":"https://github.com/pgmpy","followers_url":"https://api.github.com/users/pgmpy/followers","following_url":"https://api.github.com/users/pgmpy/following{/other_user}","gists_url":"https://api.github.com/users/pgmpy/gists{/gist_id}","starred_url":"https://api.github.com/users/pgmpy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pgmpy/subscriptions","organizations_url":"https://api.github.com/users/pgmpy/orgs","repos_url":"https://api.github.com/users/pgmpy/repos","events_url":"https://api.github.com/users/pgmpy/events{/privacy}","received_events_url":"https://api.github.com/users/pgmpy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pgmpy/pgmpy","description":"Python Library for Probabilistic Graphical Models","fork":false,"url":"https://api.github.com/repos/pgmpy/pgmpy","forks_url":"https://api.github.com/repos/pgmpy/pgmpy/forks","keys_url":"https://api.github.com/repos/pgmpy/pgmpy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pgmpy/pgmpy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pgmpy/pgmpy/teams","hooks_url":"https://api.github.com/repos/pgmpy/pgmpy/hooks","issue_events_url":"https://api.github.com/repos/pgmpy/pgmpy/issues/events{/number}","events_url":"https://api.github.com/repos/pgmpy/pgmpy/events","assignees_url":"https://api.github.com/repos/pgmpy/pgmpy/assignees{/user}","branches_url":"https://api.github.com/repos/pgmpy/pgmpy/branches{/branch}","tags_url":"https://api.github.com/repos/pgmpy/pgmpy/tags","blobs_url":"https://api.github.com/repos/pgmpy/pgmpy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pgmpy/pgmpy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pgmpy/pgmpy/git/refs{/sha}","trees_url":"https://api.github.com/repos/pgmpy/pgmpy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pgmpy/pgmpy/statuses/{sha}","languages_url":"https://api.github.com/repos/pgmpy/pgmpy/languages","stargazers_url":"https://api.github.com/repos/pgmpy/pgmpy/stargazers","contributors_url":"https://api.github.com/repos/pgmpy/pgmpy/contributors","subscribers_url":"https://api.github.com/repos/pgmpy/pgmpy/subscribers","subscription_url":"https://api.github.com/repos/pgmpy/pgmpy/subscription","commits_url":"https://api.github.com/repos/pgmpy/pgmpy/commits{/sha}","git_commits_url":"https://api.github.com/repos/pgmpy/pgmpy/git/commits{/sha}","comments_url":"https://api.github.com/repos/pgmpy/pgmpy/comments{/number}","issue_comment_url":"https://api.github.com/repos/pgmpy/pgmpy/issues/comments{/number}","contents_url":"https://api.github.com/repos/pgmpy/pgmpy/contents/{+path}","compare_url":"https://api.github.com/repos/pgmpy/pgmpy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pgmpy/pgmpy/merges","archive_url":"https://api.github.com/repos/pgmpy/pgmpy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pgmpy/pgmpy/downloads","issues_url":"https://api.github.com/repos/pgmpy/pgmpy/issues{/number}","pulls_url":"https://api.github.com/repos/pgmpy/pgmpy/pulls{/number}","milestones_url":"https://api.github.com/repos/pgmpy/pgmpy/milestones{/number}","notifications_url":"https://api.github.com/repos/pgmpy/pgmpy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pgmpy/pgmpy/labels{/name}","releases_url":"https://api.github.com/repos/pgmpy/pgmpy/releases{/id}","deployments_url":"https://api.github.com/repos/pgmpy/pgmpy/deployments","created_at":"2013-09-20T08:18:58Z","updated_at":"2016-05-31T11:57:18Z","pushed_at":"2016-05-31T11:10:04Z","git_url":"git://github.com/pgmpy/pgmpy.git","ssh_url":"git@github.com:pgmpy/pgmpy.git","clone_url":"https://github.com/pgmpy/pgmpy.git","svn_url":"https://github.com/pgmpy/pgmpy","homepage":null,"size":6134,"stargazers_count":233,"watchers_count":233,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":111,"mirror_url":null,"open_issues_count":89,"forks":111,"open_issues":89,"watchers":233,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/pgmpy/pgmpy/pulls/694"},"html":{"href":"https://github.com/pgmpy/pgmpy/pull/694"},"issue":{"href":"https://api.github.com/repos/pgmpy/pgmpy/issues/694"},"comments":{"href":"https://api.github.com/repos/pgmpy/pgmpy/issues/694/comments"},"review_comments":{"href":"https://api.github.com/repos/pgmpy/pgmpy/pulls/694/comments"},"review_comment":{"href":"https://api.github.com/repos/pgmpy/pgmpy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pgmpy/pgmpy/pulls/694/commits"},"statuses":{"href":"https://api.github.com/repos/pgmpy/pgmpy/statuses/a322652e5b6e1fc5bab605d5042e10553e5a3931"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":3,"additions":109,"deletions":46,"changed_files":3}}
{"actor":{"display_login":"chrisittner"}}