{"action":"created","comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/192582774","pull_request_review_id":125388836,"id":192582774,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5MjU4Mjc3NA==","diff_hunk":"@@ -188,7 +190,21 @@ def fit(self, X, y, sample_weight=None):\n                                               sample_weight[test])\n                 else:\n                     calibrated_classifier.fit(X[test], y[test])\n-                self.calibrated_classifiers_.append(calibrated_classifier)\n+                    if hasattr(calibrated_classifier.base_estimator, 'oob_decision_function_'):\n+                        idx_pos_class = calibrated_classifier.label_encoder_.transform(\n+                            calibrated_classifier.base_estimator.classes_)\n+                        df = calibrated_classifier.base_estimator.oob_decision_function_[:, 1:]\n+                        oob[train, :] = calibrated_classifier.transform_proba(\n+                            df, idx_pos_class, len(self.classes_),\n+                            calibrated_classifier.base_estimator.oob_decision_function_)\n+                        oob_decision_function_.append(oob)\n+                        # to save memory we can remove the oob from the base estimator\n+                        delattr(calibrated_classifier.base_estimator, 'oob_decision_function_')\n+                        calibrated_classifier.base_estimator.oob_score = False\n+                    self.calibrated_classifiers_.append(calibrated_classifier)\n+                if hasattr(self.base_estimator, 'oob_score') and self.base_estimator.oob_score:\n+                    self.oob_decision_function_ = np.nanmean(np.array(oob_decision_function_), axis=0)\n+                    self.oob = True","path":"sklearn/calibration.py","position":null,"original_position":29,"commit_id":"ab48209bd4d0bc0492fa0d7f4c3b8fd0244fe411","original_commit_id":"f2819b482c5c52299d597a5e8eb158c772f5bae8","user":{"login":"yishaishimoni","id":3770267,"node_id":"MDQ6VXNlcjM3NzAyNjc=","avatar_url":"https://avatars2.githubusercontent.com/u/3770267?v=4","gravatar_id":"","url":"https://api.github.com/users/yishaishimoni","html_url":"https://github.com/yishaishimoni","followers_url":"https://api.github.com/users/yishaishimoni/followers","following_url":"https://api.github.com/users/yishaishimoni/following{/other_user}","gists_url":"https://api.github.com/users/yishaishimoni/gists{/gist_id}","starred_url":"https://api.github.com/users/yishaishimoni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yishaishimoni/subscriptions","organizations_url":"https://api.github.com/users/yishaishimoni/orgs","repos_url":"https://api.github.com/users/yishaishimoni/repos","events_url":"https://api.github.com/users/yishaishimoni/events{/privacy}","received_events_url":"https://api.github.com/users/yishaishimoni/received_events","type":"User","site_admin":false},"body":"Moved this to the init to be consistent with model behavior.\r\nThis way if you initialize with a base learner that has`oob=True` then the calibrated classifier will also be initialized the same way.\r\nThe decision function, like in random forests, is only initialized when calling `fit`\r\n","created_at":"2018-06-03T09:15:01Z","updated_at":"2018-06-03T09:15:01Z","html_url":"https://github.com/scikit-learn/scikit-learn/pull/11175#discussion_r192582774","pull_request_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/11175","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/192582774"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/11175#discussion_r192582774"},"pull_request":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/11175"}},"in_reply_to_id":192277643},"pull_request":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/11175","id":191752551,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkxNzUyNTUx","html_url":"https://github.com/scikit-learn/scikit-learn/pull/11175","diff_url":"https://github.com/scikit-learn/scikit-learn/pull/11175.diff","patch_url":"https://github.com/scikit-learn/scikit-learn/pull/11175.patch","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/11175","number":11175,"state":"open","locked":false,"title":"added oob support to CalibratedClassifierCV","user":{"login":"yishaishimoni","id":3770267,"node_id":"MDQ6VXNlcjM3NzAyNjc=","avatar_url":"https://avatars2.githubusercontent.com/u/3770267?v=4","gravatar_id":"","url":"https://api.github.com/users/yishaishimoni","html_url":"https://github.com/yishaishimoni","followers_url":"https://api.github.com/users/yishaishimoni/followers","following_url":"https://api.github.com/users/yishaishimoni/following{/other_user}","gists_url":"https://api.github.com/users/yishaishimoni/gists{/gist_id}","starred_url":"https://api.github.com/users/yishaishimoni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yishaishimoni/subscriptions","organizations_url":"https://api.github.com/users/yishaishimoni/orgs","repos_url":"https://api.github.com/users/yishaishimoni/repos","events_url":"https://api.github.com/users/yishaishimoni/events{/privacy}","received_events_url":"https://api.github.com/users/yishaishimoni/received_events","type":"User","site_admin":false},"body":"## Enhances: CalibratedClassifierCV\r\nThis pull request implements out-of-bag (oob) support for `CalibratedClassifierCV` when using a base_classifier that uses out-of-bag (e.g. `RandomForestClassifier`).\r\n\r\nIf the base_classifier has the attribute `oob_decision_function_` after training (which means that the base classifier was trained with `oob=True`) the calibrated classifier uses the fitted calibration to transform the out-of-bag predictions using that fit. \r\n\r\nImportantly, since the oob prediction is calculated for each fold, the model holds a matrix of the oob predictions for all samples in each fold and embeds the predictions for the fold (leaving nan values for the left-out fold). After the cross-validation the matrix is averaged (ignoring nan values) to obtain an oob prediction for all the samples.\r\n\r\nFinally, the `oob` attribute is set to True\r\n\r\n###note:\r\nI could not find a specific issue that this resolves.","created_at":"2018-05-31T13:23:52Z","updated_at":"2018-06-03T09:15:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"763e0bce8b3979352e89353002d2e0c997d10d12","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/11175/commits","review_comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/11175/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/11175/comments","statuses_url":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/ab48209bd4d0bc0492fa0d7f4c3b8fd0244fe411","head":{"label":"yishaishimoni:master","ref":"master","sha":"ab48209bd4d0bc0492fa0d7f4c3b8fd0244fe411","user":{"login":"yishaishimoni","id":3770267,"node_id":"MDQ6VXNlcjM3NzAyNjc=","avatar_url":"https://avatars2.githubusercontent.com/u/3770267?v=4","gravatar_id":"","url":"https://api.github.com/users/yishaishimoni","html_url":"https://github.com/yishaishimoni","followers_url":"https://api.github.com/users/yishaishimoni/followers","following_url":"https://api.github.com/users/yishaishimoni/following{/other_user}","gists_url":"https://api.github.com/users/yishaishimoni/gists{/gist_id}","starred_url":"https://api.github.com/users/yishaishimoni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yishaishimoni/subscriptions","organizations_url":"https://api.github.com/users/yishaishimoni/orgs","repos_url":"https://api.github.com/users/yishaishimoni/repos","events_url":"https://api.github.com/users/yishaishimoni/events{/privacy}","received_events_url":"https://api.github.com/users/yishaishimoni/received_events","type":"User","site_admin":false},"repo":{"id":134830739,"node_id":"MDEwOlJlcG9zaXRvcnkxMzQ4MzA3Mzk=","name":"scikit-learn","full_name":"yishaishimoni/scikit-learn","owner":{"login":"yishaishimoni","id":3770267,"node_id":"MDQ6VXNlcjM3NzAyNjc=","avatar_url":"https://avatars2.githubusercontent.com/u/3770267?v=4","gravatar_id":"","url":"https://api.github.com/users/yishaishimoni","html_url":"https://github.com/yishaishimoni","followers_url":"https://api.github.com/users/yishaishimoni/followers","following_url":"https://api.github.com/users/yishaishimoni/following{/other_user}","gists_url":"https://api.github.com/users/yishaishimoni/gists{/gist_id}","starred_url":"https://api.github.com/users/yishaishimoni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yishaishimoni/subscriptions","organizations_url":"https://api.github.com/users/yishaishimoni/orgs","repos_url":"https://api.github.com/users/yishaishimoni/repos","events_url":"https://api.github.com/users/yishaishimoni/events{/privacy}","received_events_url":"https://api.github.com/users/yishaishimoni/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yishaishimoni/scikit-learn","description":"scikit-learn: machine learning in Python","fork":true,"url":"https://api.github.com/repos/yishaishimoni/scikit-learn","forks_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/forks","keys_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/teams","hooks_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/hooks","issue_events_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/issues/events{/number}","events_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/events","assignees_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/assignees{/user}","branches_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/branches{/branch}","tags_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/tags","blobs_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/git/refs{/sha}","trees_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/statuses/{sha}","languages_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/languages","stargazers_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/stargazers","contributors_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/contributors","subscribers_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/subscribers","subscription_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/subscription","commits_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/commits{/sha}","git_commits_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/git/commits{/sha}","comments_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/comments{/number}","issue_comment_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/issues/comments{/number}","contents_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/contents/{+path}","compare_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/merges","archive_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/downloads","issues_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/issues{/number}","pulls_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/pulls{/number}","milestones_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/milestones{/number}","notifications_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/labels{/name}","releases_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/releases{/id}","deployments_url":"https://api.github.com/repos/yishaishimoni/scikit-learn/deployments","created_at":"2018-05-25T08:54:55Z","updated_at":"2018-06-03T09:13:12Z","pushed_at":"2018-06-03T09:12:51Z","git_url":"git://github.com/yishaishimoni/scikit-learn.git","ssh_url":"git@github.com:yishaishimoni/scikit-learn.git","clone_url":"https://github.com/yishaishimoni/scikit-learn.git","svn_url":"https://github.com/yishaishimoni/scikit-learn","homepage":"http://scikit-learn.org","size":89817,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"scikit-learn:master","ref":"master","sha":"a31a9067b3750972044605e63bf34dbb6770a414","user":{"login":"scikit-learn","id":365630,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2NTYzMA==","avatar_url":"https://avatars2.githubusercontent.com/u/365630?v=4","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,"node_id":"MDEwOlJlcG9zaXRvcnk4NDMyMjI=","name":"scikit-learn","full_name":"scikit-learn/scikit-learn","owner":{"login":"scikit-learn","id":365630,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2NTYzMA==","avatar_url":"https://avatars2.githubusercontent.com/u/365630?v=4","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}","deployments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/deployments","created_at":"2010-08-17T09:43:38Z","updated_at":"2018-06-03T08:26:13Z","pushed_at":"2018-06-03T09:13:12Z","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":90602,"stargazers_count":28517,"watchers_count":28517,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14167,"mirror_url":null,"archived":false,"open_issues_count":1596,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":14167,"open_issues":1596,"watchers":28517,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/11175"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/11175"},"issue":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/11175"},"comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/11175/comments"},"review_comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/11175/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/11175/commits"},"statuses":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/ab48209bd4d0bc0492fa0d7f4c3b8fd0244fe411"}},"author_association":"NONE"}}
{"actor":{"display_login":"yishaishimoni"}}