{"action":"created","comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/192663419","pull_request_review_id":125477068,"id":192663419,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5MjY2MzQxOQ==","diff_hunk":"@@ -112,23 +113,37 @@ def _choose_algorithm(self, algorithm, metric):\n         else:\n             raise ValueError(\"invalid algorithm: '{0}'\".format(algorithm))\n \n-    def fit(self, X, y=None):\n+    def fit(self, X, y=None, sample_weight=None):\n         \"\"\"Fit the Kernel Density model on the data.\n \n         Parameters\n         ----------\n         X : array_like, shape (n_samples, n_features)\n             List of n_features-dimensional data points.  Each row\n             corresponds to a single data point.\n+        sample_weight: array_like, shape (n_samples,), optional\n+            List of sample weights attached to the data X.\n         \"\"\"\n         algorithm = self._choose_algorithm(self.algorithm, self.metric)\n         X = check_array(X, order='C', dtype=DTYPE)\n \n+        if sample_weight is not None:\n+            if not hasattr(sample_weight, 'shape'):","path":"sklearn/neighbors/kde.py","position":30,"original_position":30,"commit_id":"8ff81e5d1276f94661fa13172b0190bd708b67a2","original_commit_id":"8ff81e5d1276f94661fa13172b0190bd708b67a2","user":{"login":"jnothman","id":78827,"node_id":"MDQ6VXNlcjc4ODI3","avatar_url":"https://avatars2.githubusercontent.com/u/78827?v=4","gravatar_id":"","url":"https://api.github.com/users/jnothman","html_url":"https://github.com/jnothman","followers_url":"https://api.github.com/users/jnothman/followers","following_url":"https://api.github.com/users/jnothman/following{/other_user}","gists_url":"https://api.github.com/users/jnothman/gists{/gist_id}","starred_url":"https://api.github.com/users/jnothman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jnothman/subscriptions","organizations_url":"https://api.github.com/users/jnothman/orgs","repos_url":"https://api.github.com/users/jnothman/repos","events_url":"https://api.github.com/users/jnothman/events{/privacy}","received_events_url":"https://api.github.com/users/jnothman/received_events","type":"User","site_admin":false},"body":"Why not use check_array?","created_at":"2018-06-04T08:35:59Z","updated_at":"2018-06-04T08:51:36Z","html_url":"https://github.com/scikit-learn/scikit-learn/pull/10803#discussion_r192663419","pull_request_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/10803","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/192663419"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/10803#discussion_r192663419"},"pull_request":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/10803"}}},"pull_request":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/10803","id":174582182,"node_id":"MDExOlB1bGxSZXF1ZXN0MTc0NTgyMTgy","html_url":"https://github.com/scikit-learn/scikit-learn/pull/10803","diff_url":"https://github.com/scikit-learn/scikit-learn/pull/10803.diff","patch_url":"https://github.com/scikit-learn/scikit-learn/pull/10803.patch","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/10803","number":10803,"state":"open","locked":false,"title":"[MRG] Add sample weights support to kernel density estimation (fix #4394)","user":{"login":"samronsin","id":2240469,"node_id":"MDQ6VXNlcjIyNDA0Njk=","avatar_url":"https://avatars0.githubusercontent.com/u/2240469?v=4","gravatar_id":"","url":"https://api.github.com/users/samronsin","html_url":"https://github.com/samronsin","followers_url":"https://api.github.com/users/samronsin/followers","following_url":"https://api.github.com/users/samronsin/following{/other_user}","gists_url":"https://api.github.com/users/samronsin/gists{/gist_id}","starred_url":"https://api.github.com/users/samronsin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samronsin/subscriptions","organizations_url":"https://api.github.com/users/samronsin/orgs","repos_url":"https://api.github.com/users/samronsin/repos","events_url":"https://api.github.com/users/samronsin/events{/privacy}","received_events_url":"https://api.github.com/users/samronsin/received_events","type":"User","site_admin":false},"body":"<!--\r\nThanks for contributing a pull request! Please ensure you have taken a look at\r\nthe contribution guidelines: https://github.com/scikit-learn/scikit-learn/blob/master/CONTRIBUTING.md#pull-request-checklist\r\n-->\r\n\r\nFix #4394\r\n\r\n<!--\r\nExample: Fixes #1234. See also #3456.\r\nPlease use keywords (e.g., Fixes) to create link to the issues or pull requests\r\nyou resolved, so that they will automatically be closed when your pull request\r\nis merged. See https://github.com/blog/1506-closing-issues-via-pull-requests\r\n-->\r\n\r\nThis PR adds sample weights support to kernel density estimation by adding a sample_weight array in the BinaryTree object and updating the traversal of the tree whenever sample weights are detected, all in the binary_tree.pyi Cython code.\r\n\r\nThis PR also updates the centroids of the BallTree to take the sample weights into account in ball_tree.pyx code.\r\n\r\n<!--\r\nPlease be aware that we are a loose team of volunteers so patience is\r\nnecessary; assistance handling other issues is very welcome. We value\r\nall user contributions, no matter how minor they are. If we are slow to\r\nreview, either the pull request needs some benchmarking, tinkering,\r\nconvincing, etc. or more likely the reviewers are simply busy. In either\r\ncase, we ask for your understanding during the review process.\r\nFor more information, see our FAQ on this topic:\r\nhttp://scikit-learn.org/dev/faq.html#why-is-my-pull-request-not-getting-any-attention.\r\n\r\nThanks for contributing!\r\n-->\r\n","created_at":"2018-03-13T08:01:30Z","updated_at":"2018-06-04T08:51:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"74cb2c1a13b94f4ceaf9b4668fba353ca236c9a1","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/10803/commits","review_comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/10803/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/10803/comments","statuses_url":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/8ff81e5d1276f94661fa13172b0190bd708b67a2","head":{"label":"samronsin:sample-weights-in-KDE","ref":"sample-weights-in-KDE","sha":"8ff81e5d1276f94661fa13172b0190bd708b67a2","user":{"login":"samronsin","id":2240469,"node_id":"MDQ6VXNlcjIyNDA0Njk=","avatar_url":"https://avatars0.githubusercontent.com/u/2240469?v=4","gravatar_id":"","url":"https://api.github.com/users/samronsin","html_url":"https://github.com/samronsin","followers_url":"https://api.github.com/users/samronsin/followers","following_url":"https://api.github.com/users/samronsin/following{/other_user}","gists_url":"https://api.github.com/users/samronsin/gists{/gist_id}","starred_url":"https://api.github.com/users/samronsin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samronsin/subscriptions","organizations_url":"https://api.github.com/users/samronsin/orgs","repos_url":"https://api.github.com/users/samronsin/repos","events_url":"https://api.github.com/users/samronsin/events{/privacy}","received_events_url":"https://api.github.com/users/samronsin/received_events","type":"User","site_admin":false},"repo":{"id":125010107,"node_id":"MDEwOlJlcG9zaXRvcnkxMjUwMTAxMDc=","name":"scikit-learn","full_name":"samronsin/scikit-learn","owner":{"login":"samronsin","id":2240469,"node_id":"MDQ6VXNlcjIyNDA0Njk=","avatar_url":"https://avatars0.githubusercontent.com/u/2240469?v=4","gravatar_id":"","url":"https://api.github.com/users/samronsin","html_url":"https://github.com/samronsin","followers_url":"https://api.github.com/users/samronsin/followers","following_url":"https://api.github.com/users/samronsin/following{/other_user}","gists_url":"https://api.github.com/users/samronsin/gists{/gist_id}","starred_url":"https://api.github.com/users/samronsin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samronsin/subscriptions","organizations_url":"https://api.github.com/users/samronsin/orgs","repos_url":"https://api.github.com/users/samronsin/repos","events_url":"https://api.github.com/users/samronsin/events{/privacy}","received_events_url":"https://api.github.com/users/samronsin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/samronsin/scikit-learn","description":"scikit-learn: machine learning in Python","fork":true,"url":"https://api.github.com/repos/samronsin/scikit-learn","forks_url":"https://api.github.com/repos/samronsin/scikit-learn/forks","keys_url":"https://api.github.com/repos/samronsin/scikit-learn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/samronsin/scikit-learn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/samronsin/scikit-learn/teams","hooks_url":"https://api.github.com/repos/samronsin/scikit-learn/hooks","issue_events_url":"https://api.github.com/repos/samronsin/scikit-learn/issues/events{/number}","events_url":"https://api.github.com/repos/samronsin/scikit-learn/events","assignees_url":"https://api.github.com/repos/samronsin/scikit-learn/assignees{/user}","branches_url":"https://api.github.com/repos/samronsin/scikit-learn/branches{/branch}","tags_url":"https://api.github.com/repos/samronsin/scikit-learn/tags","blobs_url":"https://api.github.com/repos/samronsin/scikit-learn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/samronsin/scikit-learn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/samronsin/scikit-learn/git/refs{/sha}","trees_url":"https://api.github.com/repos/samronsin/scikit-learn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/samronsin/scikit-learn/statuses/{sha}","languages_url":"https://api.github.com/repos/samronsin/scikit-learn/languages","stargazers_url":"https://api.github.com/repos/samronsin/scikit-learn/stargazers","contributors_url":"https://api.github.com/repos/samronsin/scikit-learn/contributors","subscribers_url":"https://api.github.com/repos/samronsin/scikit-learn/subscribers","subscription_url":"https://api.github.com/repos/samronsin/scikit-learn/subscription","commits_url":"https://api.github.com/repos/samronsin/scikit-learn/commits{/sha}","git_commits_url":"https://api.github.com/repos/samronsin/scikit-learn/git/commits{/sha}","comments_url":"https://api.github.com/repos/samronsin/scikit-learn/comments{/number}","issue_comment_url":"https://api.github.com/repos/samronsin/scikit-learn/issues/comments{/number}","contents_url":"https://api.github.com/repos/samronsin/scikit-learn/contents/{+path}","compare_url":"https://api.github.com/repos/samronsin/scikit-learn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/samronsin/scikit-learn/merges","archive_url":"https://api.github.com/repos/samronsin/scikit-learn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/samronsin/scikit-learn/downloads","issues_url":"https://api.github.com/repos/samronsin/scikit-learn/issues{/number}","pulls_url":"https://api.github.com/repos/samronsin/scikit-learn/pulls{/number}","milestones_url":"https://api.github.com/repos/samronsin/scikit-learn/milestones{/number}","notifications_url":"https://api.github.com/repos/samronsin/scikit-learn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/samronsin/scikit-learn/labels{/name}","releases_url":"https://api.github.com/repos/samronsin/scikit-learn/releases{/id}","deployments_url":"https://api.github.com/repos/samronsin/scikit-learn/deployments","created_at":"2018-03-13T07:29:06Z","updated_at":"2018-03-13T07:29:16Z","pushed_at":"2018-06-03T20:02:14Z","git_url":"git://github.com/samronsin/scikit-learn.git","ssh_url":"git@github.com:samronsin/scikit-learn.git","clone_url":"https://github.com/samronsin/scikit-learn.git","svn_url":"https://github.com/samronsin/scikit-learn","homepage":"http://scikit-learn.org","size":89763,"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":"8585275120d713cdf98466592383621dce40da92","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-04T07:55:06Z","pushed_at":"2018-06-04T07:41:56Z","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":28534,"watchers_count":28534,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14171,"mirror_url":null,"archived":false,"open_issues_count":1599,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":14171,"open_issues":1599,"watchers":28534,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/10803"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/10803"},"issue":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/10803"},"comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/10803/comments"},"review_comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/10803/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/10803/commits"},"statuses":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/8ff81e5d1276f94661fa13172b0190bd708b67a2"}},"author_association":"NONE"}}
{"actor":{"display_login":"jnothman"}}