{"action":"created","comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/49698157","id":49698157,"diff_hunk":"@@ -199,3 +199,118 @@ note::\n   The ``partial_fit`` method call of naive Bayes models introduces some\n   computational overhead. It is recommended to use data chunk sizes that are as\n   large as possible, that is as the available RAM allows.\n+\n+\n+Non-naive Bayes\n+---------------\n+\n+As mentioned above, naive Bayesian methods are generally very fast, but often\n+inaccurate estimators.  This can be addressed by relaxing the assumptions that\n+make the models naive, so that more accurate classifications are possible.\n+\n+If we return to the general formalism outlined above, we can see that the\n+generic model for Bayesian classification is:\n+\n+.. math::\n+   \\hat{y} = \\arg\\max_y P(y) \\prod_{i=1}^{n} P(x_i \\mid y).\n+\n+This model only becomes \"naive\" when we introduce certain assumptions about\n+the form of :math:`P(x_i \\mid y)`, e.g. that each class is drawn from an\n+axis-aligned normal distribution (the assumption for Gaussian Naive Bayes).\n+\n+However, assumptions like these are in no way required for generative\n+Bayesian classification formalism: we can equally well fit any suitable\n+density model to each category to estimate :math:`P(x_i \\mid y)`.  Some","path":"doc/modules/naive_bayes.rst","position":25,"original_position":25,"commit_id":"3f8666a1505d223e94401b6d9f6cfb678057064e","original_commit_id":"3f8666a1505d223e94401b6d9f6cfb678057064e","user":{"login":"agramfort","id":161052,"avatar_url":"https://avatars.githubusercontent.com/u/161052?v=3","gravatar_id":"","url":"https://api.github.com/users/agramfort","html_url":"https://github.com/agramfort","followers_url":"https://api.github.com/users/agramfort/followers","following_url":"https://api.github.com/users/agramfort/following{/other_user}","gists_url":"https://api.github.com/users/agramfort/gists{/gist_id}","starred_url":"https://api.github.com/users/agramfort/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agramfort/subscriptions","organizations_url":"https://api.github.com/users/agramfort/orgs","repos_url":"https://api.github.com/users/agramfort/repos","events_url":"https://api.github.com/users/agramfort/events{/privacy}","received_events_url":"https://api.github.com/users/agramfort/received_events","type":"User","site_admin":false},"body":"this gives the impression that your code estimates a KDE/GMM for each feature but you actually estimate `P(x \\mid y)`\r\n\r\nnote that this can be problematic in high dimension (kde has issues in high dim). A middle ground could be to support also KDE/GMM for each feature ie keep the naive independence. This could be done with an option.","created_at":"2016-01-14T08:28:10Z","updated_at":"2016-01-14T08:28:10Z","html_url":"https://github.com/scikit-learn/scikit-learn/pull/2468#discussion_r49698157","pull_request_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/2468","_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/49698157"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/2468#discussion_r49698157"},"pull_request":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/2468"}}},"pull_request":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/2468","id":8504958,"html_url":"https://github.com/scikit-learn/scikit-learn/pull/2468","diff_url":"https://github.com/scikit-learn/scikit-learn/pull/2468.diff","patch_url":"https://github.com/scikit-learn/scikit-learn/pull/2468.patch","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/2468","number":2468,"state":"open","locked":false,"title":"[MRG] Generative Classification","user":{"login":"jakevdp","id":781659,"avatar_url":"https://avatars.githubusercontent.com/u/781659?v=3","gravatar_id":"","url":"https://api.github.com/users/jakevdp","html_url":"https://github.com/jakevdp","followers_url":"https://api.github.com/users/jakevdp/followers","following_url":"https://api.github.com/users/jakevdp/following{/other_user}","gists_url":"https://api.github.com/users/jakevdp/gists{/gist_id}","starred_url":"https://api.github.com/users/jakevdp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakevdp/subscriptions","organizations_url":"https://api.github.com/users/jakevdp/orgs","repos_url":"https://api.github.com/users/jakevdp/repos","events_url":"https://api.github.com/users/jakevdp/events{/privacy}","received_events_url":"https://api.github.com/users/jakevdp/received_events","type":"User","site_admin":false},"body":"This PR adds a simple meta-estimator which accepts any generative model (normal approximation, ``GMM``, ``KernelDensity``, etc.) and uses it to construct a generative Bayesian classifier.\r\n\r\nTodo:\r\n- [x] code documentation\r\n- [x] narrative docs\r\n- [x] testing\r\n- [x] examples\r\n- [ ] allow class-wise cross validation for the density model?","created_at":"2013-09-21T15:46:54Z","updated_at":"2016-01-14T08:28:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3d80bd93adc4d270b5750e38f3b453b6a26cc29c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/2468/commits","review_comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/2468/comments","review_comment_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/2468/comments","statuses_url":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/3f8666a1505d223e94401b6d9f6cfb678057064e","head":{"label":"jakevdp:generative_class","ref":"generative_class","sha":"3f8666a1505d223e94401b6d9f6cfb678057064e","user":{"login":"jakevdp","id":781659,"avatar_url":"https://avatars.githubusercontent.com/u/781659?v=3","gravatar_id":"","url":"https://api.github.com/users/jakevdp","html_url":"https://github.com/jakevdp","followers_url":"https://api.github.com/users/jakevdp/followers","following_url":"https://api.github.com/users/jakevdp/following{/other_user}","gists_url":"https://api.github.com/users/jakevdp/gists{/gist_id}","starred_url":"https://api.github.com/users/jakevdp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakevdp/subscriptions","organizations_url":"https://api.github.com/users/jakevdp/orgs","repos_url":"https://api.github.com/users/jakevdp/repos","events_url":"https://api.github.com/users/jakevdp/events{/privacy}","received_events_url":"https://api.github.com/users/jakevdp/received_events","type":"User","site_admin":false},"repo":{"id":1741790,"name":"scikit-learn","full_name":"jakevdp/scikit-learn","owner":{"login":"jakevdp","id":781659,"avatar_url":"https://avatars.githubusercontent.com/u/781659?v=3","gravatar_id":"","url":"https://api.github.com/users/jakevdp","html_url":"https://github.com/jakevdp","followers_url":"https://api.github.com/users/jakevdp/followers","following_url":"https://api.github.com/users/jakevdp/following{/other_user}","gists_url":"https://api.github.com/users/jakevdp/gists{/gist_id}","starred_url":"https://api.github.com/users/jakevdp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakevdp/subscriptions","organizations_url":"https://api.github.com/users/jakevdp/orgs","repos_url":"https://api.github.com/users/jakevdp/repos","events_url":"https://api.github.com/users/jakevdp/events{/privacy}","received_events_url":"https://api.github.com/users/jakevdp/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jakevdp/scikit-learn","description":"scikit-learn: machine learning in Python","fork":true,"url":"https://api.github.com/repos/jakevdp/scikit-learn","forks_url":"https://api.github.com/repos/jakevdp/scikit-learn/forks","keys_url":"https://api.github.com/repos/jakevdp/scikit-learn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jakevdp/scikit-learn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jakevdp/scikit-learn/teams","hooks_url":"https://api.github.com/repos/jakevdp/scikit-learn/hooks","issue_events_url":"https://api.github.com/repos/jakevdp/scikit-learn/issues/events{/number}","events_url":"https://api.github.com/repos/jakevdp/scikit-learn/events","assignees_url":"https://api.github.com/repos/jakevdp/scikit-learn/assignees{/user}","branches_url":"https://api.github.com/repos/jakevdp/scikit-learn/branches{/branch}","tags_url":"https://api.github.com/repos/jakevdp/scikit-learn/tags","blobs_url":"https://api.github.com/repos/jakevdp/scikit-learn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jakevdp/scikit-learn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jakevdp/scikit-learn/git/refs{/sha}","trees_url":"https://api.github.com/repos/jakevdp/scikit-learn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jakevdp/scikit-learn/statuses/{sha}","languages_url":"https://api.github.com/repos/jakevdp/scikit-learn/languages","stargazers_url":"https://api.github.com/repos/jakevdp/scikit-learn/stargazers","contributors_url":"https://api.github.com/repos/jakevdp/scikit-learn/contributors","subscribers_url":"https://api.github.com/repos/jakevdp/scikit-learn/subscribers","subscription_url":"https://api.github.com/repos/jakevdp/scikit-learn/subscription","commits_url":"https://api.github.com/repos/jakevdp/scikit-learn/commits{/sha}","git_commits_url":"https://api.github.com/repos/jakevdp/scikit-learn/git/commits{/sha}","comments_url":"https://api.github.com/repos/jakevdp/scikit-learn/comments{/number}","issue_comment_url":"https://api.github.com/repos/jakevdp/scikit-learn/issues/comments{/number}","contents_url":"https://api.github.com/repos/jakevdp/scikit-learn/contents/{+path}","compare_url":"https://api.github.com/repos/jakevdp/scikit-learn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jakevdp/scikit-learn/merges","archive_url":"https://api.github.com/repos/jakevdp/scikit-learn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jakevdp/scikit-learn/downloads","issues_url":"https://api.github.com/repos/jakevdp/scikit-learn/issues{/number}","pulls_url":"https://api.github.com/repos/jakevdp/scikit-learn/pulls{/number}","milestones_url":"https://api.github.com/repos/jakevdp/scikit-learn/milestones{/number}","notifications_url":"https://api.github.com/repos/jakevdp/scikit-learn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jakevdp/scikit-learn/labels{/name}","releases_url":"https://api.github.com/repos/jakevdp/scikit-learn/releases{/id}","created_at":"2011-05-13T03:54:40Z","updated_at":"2015-05-07T18:43:53Z","pushed_at":"2015-12-18T23:13:00Z","git_url":"git://github.com/jakevdp/scikit-learn.git","ssh_url":"git@github.com:jakevdp/scikit-learn.git","clone_url":"https://github.com/jakevdp/scikit-learn.git","svn_url":"https://github.com/jakevdp/scikit-learn","homepage":"http://scikit-learn.sourceforge.net","size":69752,"stargazers_count":9,"watchers_count":9,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":0,"forks":12,"open_issues":0,"watchers":9,"default_branch":"master"}},"base":{"label":"scikit-learn:master","ref":"master","sha":"3f8743f47b61a269e8bfff2322cb544170976574","user":{"login":"scikit-learn","id":365630,"avatar_url":"https://avatars.githubusercontent.com/u/365630?v=3","gravatar_id":"","url":"https://api.github.com/users/scikit-learn","html_url":"https://github.com/scikit-learn","followers_url":"https://api.github.com/users/scikit-learn/followers","following_url":"https://api.github.com/users/scikit-learn/following{/other_user}","gists_url":"https://api.github.com/users/scikit-learn/gists{/gist_id}","starred_url":"https://api.github.com/users/scikit-learn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scikit-learn/subscriptions","organizations_url":"https://api.github.com/users/scikit-learn/orgs","repos_url":"https://api.github.com/users/scikit-learn/repos","events_url":"https://api.github.com/users/scikit-learn/events{/privacy}","received_events_url":"https://api.github.com/users/scikit-learn/received_events","type":"Organization","site_admin":false},"repo":{"id":843222,"name":"scikit-learn","full_name":"scikit-learn/scikit-learn","owner":{"login":"scikit-learn","id":365630,"avatar_url":"https://avatars.githubusercontent.com/u/365630?v=3","gravatar_id":"","url":"https://api.github.com/users/scikit-learn","html_url":"https://github.com/scikit-learn","followers_url":"https://api.github.com/users/scikit-learn/followers","following_url":"https://api.github.com/users/scikit-learn/following{/other_user}","gists_url":"https://api.github.com/users/scikit-learn/gists{/gist_id}","starred_url":"https://api.github.com/users/scikit-learn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scikit-learn/subscriptions","organizations_url":"https://api.github.com/users/scikit-learn/orgs","repos_url":"https://api.github.com/users/scikit-learn/repos","events_url":"https://api.github.com/users/scikit-learn/events{/privacy}","received_events_url":"https://api.github.com/users/scikit-learn/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scikit-learn/scikit-learn","description":"scikit-learn: machine learning in Python","fork":false,"url":"https://api.github.com/repos/scikit-learn/scikit-learn","forks_url":"https://api.github.com/repos/scikit-learn/scikit-learn/forks","keys_url":"https://api.github.com/repos/scikit-learn/scikit-learn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scikit-learn/scikit-learn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scikit-learn/scikit-learn/teams","hooks_url":"https://api.github.com/repos/scikit-learn/scikit-learn/hooks","issue_events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/events{/number}","events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/events","assignees_url":"https://api.github.com/repos/scikit-learn/scikit-learn/assignees{/user}","branches_url":"https://api.github.com/repos/scikit-learn/scikit-learn/branches{/branch}","tags_url":"https://api.github.com/repos/scikit-learn/scikit-learn/tags","blobs_url":"https://api.github.com/repos/scikit-learn/scikit-learn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scikit-learn/scikit-learn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scikit-learn/scikit-learn/git/refs{/sha}","trees_url":"https://api.github.com/repos/scikit-learn/scikit-learn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/{sha}","languages_url":"https://api.github.com/repos/scikit-learn/scikit-learn/languages","stargazers_url":"https://api.github.com/repos/scikit-learn/scikit-learn/stargazers","contributors_url":"https://api.github.com/repos/scikit-learn/scikit-learn/contributors","subscribers_url":"https://api.github.com/repos/scikit-learn/scikit-learn/subscribers","subscription_url":"https://api.github.com/repos/scikit-learn/scikit-learn/subscription","commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/commits{/sha}","git_commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/git/commits{/sha}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/comments{/number}","issue_comment_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/comments{/number}","contents_url":"https://api.github.com/repos/scikit-learn/scikit-learn/contents/{+path}","compare_url":"https://api.github.com/repos/scikit-learn/scikit-learn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scikit-learn/scikit-learn/merges","archive_url":"https://api.github.com/repos/scikit-learn/scikit-learn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scikit-learn/scikit-learn/downloads","issues_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues{/number}","pulls_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls{/number}","milestones_url":"https://api.github.com/repos/scikit-learn/scikit-learn/milestones{/number}","notifications_url":"https://api.github.com/repos/scikit-learn/scikit-learn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/labels{/name}","releases_url":"https://api.github.com/repos/scikit-learn/scikit-learn/releases{/id}","created_at":"2010-08-17T09:43:38Z","updated_at":"2016-01-14T08:23:28Z","pushed_at":"2016-01-14T08:17:34Z","git_url":"git://github.com/scikit-learn/scikit-learn.git","ssh_url":"git@github.com:scikit-learn/scikit-learn.git","clone_url":"https://github.com/scikit-learn/scikit-learn.git","svn_url":"https://github.com/scikit-learn/scikit-learn","homepage":"http://scikit-learn.org","size":104714,"stargazers_count":9198,"watchers_count":9198,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5417,"mirror_url":null,"open_issues_count":1000,"forks":5417,"open_issues":1000,"watchers":9198,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/2468"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/2468"},"issue":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/2468"},"comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/2468/comments"},"review_comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/2468/comments"},"review_comment":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/2468/commits"},"statuses":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/3f8666a1505d223e94401b6d9f6cfb678057064e"}}}}