{"action":"created","comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/75995023","id":75995023,"diff_hunk":"@@ -472,3 +561,50 @@ def test_X1d_inverse_transform():\n     X = np.ones(10)\n     msg = \"1d X will not be reshaped in pipeline.inverse_transform\"\n     assert_warns_message(FutureWarning, msg, pipeline.inverse_transform, X)\n+\n+\n+def test_set_feature_union_steps():\n+    mult2 = MultT(2)\n+    mult2.get_feature_names = lambda: ['x2']\n+    mult3 = MultT(3)\n+    mult3.get_feature_names = lambda: ['x3']\n+    mult5 = MultT(5)\n+    mult5.get_feature_names = lambda: ['x5']\n+\n+    ft = FeatureUnion([('m2', mult2), ('m3', mult3)])\n+    assert_array_equal([[2, 3]], ft.transform(np.asarray([[1]])))\n+    assert_equal(['m2__x2', 'm3__x3'], ft.get_feature_names())\n+\n+    # Directly setting attr\n+    ft.transformer_list = [('m5', mult5)]\n+    assert_array_equal([[5]], ft.transform(np.asarray([[1]])))\n+    assert_equal(['m5__x5'], ft.get_feature_names())\n+\n+    # Using set_params\n+    ft.set_params(transformer_list=[('mock', mult3)])\n+    assert_array_equal([[3]], ft.transform(np.asarray([[1]])))\n+    assert_equal(['mock__x3'], ft.get_feature_names())\n+\n+    # Using set_params to replace single step\n+    ft.set_params(mock=mult5)\n+    assert_array_equal([[5]], ft.transform(np.asarray([[1]])))\n+    assert_equal(['mock__x5'], ft.get_feature_names())\n+\n+\n+def test_set_feature_union_step_none():\n+    mult2 = MultT(2)\n+    mult2.get_feature_names = lambda: ['x2']\n+    mult3 = MultT(3)\n+    mult3.get_feature_names = lambda: ['x3']\n+\n+    ft = FeatureUnion([('m2', mult2), ('m3', mult3)])\n+    assert_array_equal([[2, 3]], ft.transform(np.asarray([[1]])))\n+    assert_equal(['m2__x2', 'm3__x3'], ft.get_feature_names())","path":"sklearn/tests/test_pipeline.py","position":170,"original_position":170,"commit_id":"074ad5a985b50620e701e8357650e725cc1fc36f","original_commit_id":"074ad5a985b50620e701e8357650e725cc1fc36f","user":{"login":"MechCoder","id":1867024,"avatar_url":"https://avatars.githubusercontent.com/u/1867024?v=3","gravatar_id":"","url":"https://api.github.com/users/MechCoder","html_url":"https://github.com/MechCoder","followers_url":"https://api.github.com/users/MechCoder/followers","following_url":"https://api.github.com/users/MechCoder/following{/other_user}","gists_url":"https://api.github.com/users/MechCoder/gists{/gist_id}","starred_url":"https://api.github.com/users/MechCoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MechCoder/subscriptions","organizations_url":"https://api.github.com/users/MechCoder/orgs","repos_url":"https://api.github.com/users/MechCoder/repos","events_url":"https://api.github.com/users/MechCoder/events{/privacy}","received_events_url":"https://api.github.com/users/MechCoder/received_events","type":"User","site_admin":false},"body":"The 3 lines above have already been tested right?","created_at":"2016-08-24T05:00:08Z","updated_at":"2016-08-24T05:00:08Z","html_url":"https://github.com/scikit-learn/scikit-learn/pull/1769#discussion_r75995023","pull_request_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/1769","_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/75995023"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/1769#discussion_r75995023"},"pull_request":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/1769"}}},"pull_request":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/1769","id":4586824,"html_url":"https://github.com/scikit-learn/scikit-learn/pull/1769","diff_url":"https://github.com/scikit-learn/scikit-learn/pull/1769.diff","patch_url":"https://github.com/scikit-learn/scikit-learn/pull/1769.patch","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/1769","number":1769,"state":"open","locked":false,"title":"[MRG + 1] ENH enable setting pipeline components as parameters","user":{"login":"jnothman","id":78827,"avatar_url":"https://avatars.githubusercontent.com/u/78827?v=3","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":"Until now, `get_params()` would return the steps of a pipeline by name, but setting them would fail silently (by setting an unused attribute); fixes bug #1800.\r\n\r\nThis allows users to grid search over alternative estimators for some step, as illustrated in the included example, or even to delete a step in a search by setting it to `None`.\r\nBut it may also be more directly practical: while a user may currently use `get_params` to extract an estimator from a nested pipeline using the double-underscore naming convention, e.g. [for selective serialisation](http://stackoverflow.com/questions/36259967/how-to-pickle-individual-steps-in-sklearns-pipeline/36273792#36273792), they cannot use the reciprocal `set_params` which this PR enables.\r\n\r\nThis changeset also prohibits step names that equal initialisation parameters of the pipeline; otherwise `FeatureUnion.set_params(transformer_weights=foo)` would be ambiguous.\r\n","created_at":"2013-03-13T07:19:57Z","updated_at":"2016-08-24T05:00:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"76559d00114392f772e7e600be2cef35d6ebe94e","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/milestones/18","html_url":"https://github.com/scikit-learn/scikit-learn/milestones/0.18","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/milestones/18/labels","id":1314892,"number":18,"title":"0.18","description":"","creator":{"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},"open_issues":66,"closed_issues":32,"state":"open","created_at":"2015-09-20T02:17:00Z","updated_at":"2016-08-23T21:56:56Z","due_on":"2016-02-29T08:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/1769/commits","review_comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/1769/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/1769/comments","statuses_url":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/074ad5a985b50620e701e8357650e725cc1fc36f","head":{"label":"jnothman:pipeline_params","ref":"pipeline_params","sha":"074ad5a985b50620e701e8357650e725cc1fc36f","user":{"login":"jnothman","id":78827,"avatar_url":"https://avatars.githubusercontent.com/u/78827?v=3","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},"repo":{"id":8691611,"name":"scikit-learn","full_name":"jnothman/scikit-learn","owner":{"login":"jnothman","id":78827,"avatar_url":"https://avatars.githubusercontent.com/u/78827?v=3","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},"private":false,"html_url":"https://github.com/jnothman/scikit-learn","description":"scikit-learn: machine learning in Python","fork":true,"url":"https://api.github.com/repos/jnothman/scikit-learn","forks_url":"https://api.github.com/repos/jnothman/scikit-learn/forks","keys_url":"https://api.github.com/repos/jnothman/scikit-learn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jnothman/scikit-learn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jnothman/scikit-learn/teams","hooks_url":"https://api.github.com/repos/jnothman/scikit-learn/hooks","issue_events_url":"https://api.github.com/repos/jnothman/scikit-learn/issues/events{/number}","events_url":"https://api.github.com/repos/jnothman/scikit-learn/events","assignees_url":"https://api.github.com/repos/jnothman/scikit-learn/assignees{/user}","branches_url":"https://api.github.com/repos/jnothman/scikit-learn/branches{/branch}","tags_url":"https://api.github.com/repos/jnothman/scikit-learn/tags","blobs_url":"https://api.github.com/repos/jnothman/scikit-learn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jnothman/scikit-learn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jnothman/scikit-learn/git/refs{/sha}","trees_url":"https://api.github.com/repos/jnothman/scikit-learn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jnothman/scikit-learn/statuses/{sha}","languages_url":"https://api.github.com/repos/jnothman/scikit-learn/languages","stargazers_url":"https://api.github.com/repos/jnothman/scikit-learn/stargazers","contributors_url":"https://api.github.com/repos/jnothman/scikit-learn/contributors","subscribers_url":"https://api.github.com/repos/jnothman/scikit-learn/subscribers","subscription_url":"https://api.github.com/repos/jnothman/scikit-learn/subscription","commits_url":"https://api.github.com/repos/jnothman/scikit-learn/commits{/sha}","git_commits_url":"https://api.github.com/repos/jnothman/scikit-learn/git/commits{/sha}","comments_url":"https://api.github.com/repos/jnothman/scikit-learn/comments{/number}","issue_comment_url":"https://api.github.com/repos/jnothman/scikit-learn/issues/comments{/number}","contents_url":"https://api.github.com/repos/jnothman/scikit-learn/contents/{+path}","compare_url":"https://api.github.com/repos/jnothman/scikit-learn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jnothman/scikit-learn/merges","archive_url":"https://api.github.com/repos/jnothman/scikit-learn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jnothman/scikit-learn/downloads","issues_url":"https://api.github.com/repos/jnothman/scikit-learn/issues{/number}","pulls_url":"https://api.github.com/repos/jnothman/scikit-learn/pulls{/number}","milestones_url":"https://api.github.com/repos/jnothman/scikit-learn/milestones{/number}","notifications_url":"https://api.github.com/repos/jnothman/scikit-learn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jnothman/scikit-learn/labels{/name}","releases_url":"https://api.github.com/repos/jnothman/scikit-learn/releases{/id}","deployments_url":"https://api.github.com/repos/jnothman/scikit-learn/deployments","created_at":"2013-03-10T21:10:51Z","updated_at":"2016-01-27T23:57:21Z","pushed_at":"2016-08-17T14:25:31Z","git_url":"git://github.com/jnothman/scikit-learn.git","ssh_url":"git@github.com:jnothman/scikit-learn.git","clone_url":"https://github.com/jnothman/scikit-learn.git","svn_url":"https://github.com/jnothman/scikit-learn","homepage":"http://scikit-learn.org","size":75273,"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":"9539c0c00ebac2d9f99633d7080931deaa046386","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}","deployments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/deployments","created_at":"2010-08-17T09:43:38Z","updated_at":"2016-08-24T04:45:35Z","pushed_at":"2016-08-24T04:14:02Z","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":122362,"stargazers_count":12966,"watchers_count":12966,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7503,"mirror_url":null,"open_issues_count":1259,"forks":7503,"open_issues":1259,"watchers":12966,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/1769"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/1769"},"issue":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/1769"},"comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/1769/comments"},"review_comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/1769/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/1769/commits"},"statuses":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/074ad5a985b50620e701e8357650e725cc1fc36f"}}}}
{"actor":{"display_login":"MechCoder"}}