{"action":"created","comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/38984276","id":38984276,"diff_hunk":"@@ -52,6 +53,11 @@ def _parallel_build_estimators(n_estimators, ensemble, X, y, sample_weight,\n     bootstrap_features = ensemble.bootstrap_features\n     support_sample_weight = has_fit_parameter(ensemble.base_estimator_,\n                                               \"sample_weight\")\n+    # Logistic regression does not support sample weights with liblinear\n+    if (isinstance(ensemble.base_estimator_,LogisticRegression) and ","path":"sklearn/ensemble/bagging.py","position":13,"original_position":13,"commit_id":"310125895d5d9f4d327c0cc6b80640160c120c40","original_commit_id":"310125895d5d9f4d327c0cc6b80640160c120c40","user":{"login":"amueller","id":449558,"avatar_url":"https://avatars.githubusercontent.com/u/449558?v=3","gravatar_id":"","url":"https://api.github.com/users/amueller","html_url":"https://github.com/amueller","followers_url":"https://api.github.com/users/amueller/followers","following_url":"https://api.github.com/users/amueller/following{/other_user}","gists_url":"https://api.github.com/users/amueller/gists{/gist_id}","starred_url":"https://api.github.com/users/amueller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amueller/subscriptions","organizations_url":"https://api.github.com/users/amueller/orgs","repos_url":"https://api.github.com/users/amueller/repos","events_url":"https://api.github.com/users/amueller/events{/privacy}","received_events_url":"https://api.github.com/users/amueller/received_events","type":"User","site_admin":false},"body":"What's the test failure? Mismatch of error messages?","created_at":"2015-09-08T21:43:44Z","updated_at":"2015-09-08T21:43:44Z","html_url":"https://github.com/scikit-learn/scikit-learn/pull/5204#discussion_r38984276","pull_request_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5204","_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/38984276"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/5204#discussion_r38984276"},"pull_request":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5204"}}},"pull_request":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5204","id":44040847,"html_url":"https://github.com/scikit-learn/scikit-learn/pull/5204","diff_url":"https://github.com/scikit-learn/scikit-learn/pull/5204.diff","patch_url":"https://github.com/scikit-learn/scikit-learn/pull/5204.patch","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/5204","number":5204,"state":"open","locked":false,"title":"Enabling sample weights for 2 of the 3 logistic regression solvers","user":{"login":"vstolbunov","id":3589779,"avatar_url":"https://avatars.githubusercontent.com/u/3589779?v=3","gravatar_id":"","url":"https://api.github.com/users/vstolbunov","html_url":"https://github.com/vstolbunov","followers_url":"https://api.github.com/users/vstolbunov/followers","following_url":"https://api.github.com/users/vstolbunov/following{/other_user}","gists_url":"https://api.github.com/users/vstolbunov/gists{/gist_id}","starred_url":"https://api.github.com/users/vstolbunov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vstolbunov/subscriptions","organizations_url":"https://api.github.com/users/vstolbunov/orgs","repos_url":"https://api.github.com/users/vstolbunov/repos","events_url":"https://api.github.com/users/vstolbunov/events{/privacy}","received_events_url":"https://api.github.com/users/vstolbunov/received_events","type":"User","site_admin":false},"body":"I observed that logistic regression could not be trained with sample weights. By digging deeper I found that two of the three solvers (`lbfgs` and `newton-cg`) could handle sample weights, while the default solver (`liblinear`) could not and as a result sample weights were hidden from the user completely. To remedy this, I have:\r\n\r\n* added a `ValueError` when the `liblinear` solver is used with sample weights\r\n* allowed for `sample_weight` to be a parameter in both `LogisticRegression.fit()` and `LogisticRegressionCV.fit()`\r\n* documented the parameter everywhere it can be passed\r\n* updated the documentation for the `class_weight` parameter to note that it will be multiplied by `sample_weight` if `sample_weight` is provided in `.fit()`\r\n* handled sample weights appropriately throughout the fitting by passing them to `logistic_regression_path` and `_log_reg_scoring_path`\r\n* added a new test function in test_logistic.py with four different tests to make sure:\r\n   * that a `ValueError` is thrown when `liblinear` is used with sample weights\r\n   * that passing sample weights as `np.ones` is the same as not passing them (default `None`)\r\n   * passing sample weights to both `lbfgs` and `newton-cg` solvers yields the same results\r\n   * passing class weights to scale classes is the same as passing sample weights that scale the training examples of those classes","created_at":"2015-09-02T20:51:58Z","updated_at":"2015-09-08T21:43:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8e58ce9e80b3580d4a1fa445306ec6d6211f88bd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5204/commits","review_comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5204/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/5204/comments","statuses_url":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/310125895d5d9f4d327c0cc6b80640160c120c40","head":{"label":"vstolbunov:lr-sampleweights","ref":"lr-sampleweights","sha":"310125895d5d9f4d327c0cc6b80640160c120c40","user":{"login":"vstolbunov","id":3589779,"avatar_url":"https://avatars.githubusercontent.com/u/3589779?v=3","gravatar_id":"","url":"https://api.github.com/users/vstolbunov","html_url":"https://github.com/vstolbunov","followers_url":"https://api.github.com/users/vstolbunov/followers","following_url":"https://api.github.com/users/vstolbunov/following{/other_user}","gists_url":"https://api.github.com/users/vstolbunov/gists{/gist_id}","starred_url":"https://api.github.com/users/vstolbunov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vstolbunov/subscriptions","organizations_url":"https://api.github.com/users/vstolbunov/orgs","repos_url":"https://api.github.com/users/vstolbunov/repos","events_url":"https://api.github.com/users/vstolbunov/events{/privacy}","received_events_url":"https://api.github.com/users/vstolbunov/received_events","type":"User","site_admin":false},"repo":{"id":41808408,"name":"scikit-learn","full_name":"vstolbunov/scikit-learn","owner":{"login":"vstolbunov","id":3589779,"avatar_url":"https://avatars.githubusercontent.com/u/3589779?v=3","gravatar_id":"","url":"https://api.github.com/users/vstolbunov","html_url":"https://github.com/vstolbunov","followers_url":"https://api.github.com/users/vstolbunov/followers","following_url":"https://api.github.com/users/vstolbunov/following{/other_user}","gists_url":"https://api.github.com/users/vstolbunov/gists{/gist_id}","starred_url":"https://api.github.com/users/vstolbunov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vstolbunov/subscriptions","organizations_url":"https://api.github.com/users/vstolbunov/orgs","repos_url":"https://api.github.com/users/vstolbunov/repos","events_url":"https://api.github.com/users/vstolbunov/events{/privacy}","received_events_url":"https://api.github.com/users/vstolbunov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vstolbunov/scikit-learn","description":"scikit-learn: machine learning in Python","fork":true,"url":"https://api.github.com/repos/vstolbunov/scikit-learn","forks_url":"https://api.github.com/repos/vstolbunov/scikit-learn/forks","keys_url":"https://api.github.com/repos/vstolbunov/scikit-learn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vstolbunov/scikit-learn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vstolbunov/scikit-learn/teams","hooks_url":"https://api.github.com/repos/vstolbunov/scikit-learn/hooks","issue_events_url":"https://api.github.com/repos/vstolbunov/scikit-learn/issues/events{/number}","events_url":"https://api.github.com/repos/vstolbunov/scikit-learn/events","assignees_url":"https://api.github.com/repos/vstolbunov/scikit-learn/assignees{/user}","branches_url":"https://api.github.com/repos/vstolbunov/scikit-learn/branches{/branch}","tags_url":"https://api.github.com/repos/vstolbunov/scikit-learn/tags","blobs_url":"https://api.github.com/repos/vstolbunov/scikit-learn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vstolbunov/scikit-learn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vstolbunov/scikit-learn/git/refs{/sha}","trees_url":"https://api.github.com/repos/vstolbunov/scikit-learn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vstolbunov/scikit-learn/statuses/{sha}","languages_url":"https://api.github.com/repos/vstolbunov/scikit-learn/languages","stargazers_url":"https://api.github.com/repos/vstolbunov/scikit-learn/stargazers","contributors_url":"https://api.github.com/repos/vstolbunov/scikit-learn/contributors","subscribers_url":"https://api.github.com/repos/vstolbunov/scikit-learn/subscribers","subscription_url":"https://api.github.com/repos/vstolbunov/scikit-learn/subscription","commits_url":"https://api.github.com/repos/vstolbunov/scikit-learn/commits{/sha}","git_commits_url":"https://api.github.com/repos/vstolbunov/scikit-learn/git/commits{/sha}","comments_url":"https://api.github.com/repos/vstolbunov/scikit-learn/comments{/number}","issue_comment_url":"https://api.github.com/repos/vstolbunov/scikit-learn/issues/comments{/number}","contents_url":"https://api.github.com/repos/vstolbunov/scikit-learn/contents/{+path}","compare_url":"https://api.github.com/repos/vstolbunov/scikit-learn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vstolbunov/scikit-learn/merges","archive_url":"https://api.github.com/repos/vstolbunov/scikit-learn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vstolbunov/scikit-learn/downloads","issues_url":"https://api.github.com/repos/vstolbunov/scikit-learn/issues{/number}","pulls_url":"https://api.github.com/repos/vstolbunov/scikit-learn/pulls{/number}","milestones_url":"https://api.github.com/repos/vstolbunov/scikit-learn/milestones{/number}","notifications_url":"https://api.github.com/repos/vstolbunov/scikit-learn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vstolbunov/scikit-learn/labels{/name}","releases_url":"https://api.github.com/repos/vstolbunov/scikit-learn/releases{/id}","created_at":"2015-09-02T15:10:40Z","updated_at":"2015-09-02T15:10:45Z","pushed_at":"2015-09-03T19:48:07Z","git_url":"git://github.com/vstolbunov/scikit-learn.git","ssh_url":"git@github.com:vstolbunov/scikit-learn.git","clone_url":"https://github.com/vstolbunov/scikit-learn.git","svn_url":"https://github.com/vstolbunov/scikit-learn","homepage":"http://scikit-learn.org","size":64995,"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":"master"}},"base":{"label":"scikit-learn:master","ref":"master","sha":"e2e5fbd8e15507247d6b44f8e7a9c426ad695695","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":"2015-09-08T18:00:20Z","pushed_at":"2015-09-08T21:34:57Z","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":131724,"stargazers_count":7426,"watchers_count":7426,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4393,"mirror_url":null,"open_issues_count":766,"forks":4393,"open_issues":766,"watchers":7426,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5204"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/5204"},"issue":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/5204"},"comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/5204/comments"},"review_comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5204/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/5204/commits"},"statuses":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/310125895d5d9f4d327c0cc6b80640160c120c40"}}}}