{"action":"created","comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/65005703","id":65005703,"diff_hunk":"@@ -386,23 +392,99 @@ def check_indicator(X, expected_imputed_features, axis):\n def test_indicator_features():\n     # one feature with all missng values\n     X = np.array([\n-       [-1,  -1,   2,   3],\n-       [4,  -1,   6,  -1],\n-       [8,  -1,  10,  11],\n-       [12,  -1,  -1,  15],\n-       [16,  -1,  18,  19]\n+        [-1,  -1,   2,   3],\n+        [4,  -1,   6,  -1],\n+        [8,  -1,  10,  11],\n+        [12,  -1,  -1,  15],\n+        [16,  -1,  18,  19]\n     ])\n     check_indicator(X, np.array([0, 2, 3]), axis=0)\n-    check_indicator(X, np.array([0, 1, 2, 3]), axis=1)\n+    check_indicator(X, None, axis=1)\n \n     # one feature with all missing values and one with no missing value\n     # when axis=0 the feature gets discarded\n     X = np.array([\n-       [-1,  -1,   1,   3],\n-       [4,  -1,   0,  -1],\n-       [8,  -1,   1,  0],\n-       [0,  -1,   0,  15],\n-       [16,  -1,   1,  19]\n+        [-1,  -1,   1,   3],\n+        [4,  -1,   0,  -1],\n+        [8,  -1,   1,  0],\n+        [0,  -1,   0,  15],\n+        [16,  -1,   1,  19]\n     ])\n     check_indicator(X, np.array([0, 3]), axis=0)\n-    check_indicator(X, np.array([0, 1, 3]), axis=1)\n+    check_indicator(X, None, axis=1)\n+\n+\n+def test_indicator_features_shape():\n+\n+    X1 = np.array([\n+        [-1,  -1,   2,   3],\n+        [4,  -1,   6,  -1],\n+        [8,  -1,  10,  11],\n+        [12,  -1,  -1,  15],\n+        [16,  -1,  18,  19]\n+    ])\n+\n+    X2 = np.array([\n+        [-1,  -1,   1,   3],\n+        [4,  -1,   0,  -1],\n+        [8,  -1,   1,  0],\n+        [0,  -1,   0,  15],\n+        [16,  -1,   1,  19]\n+    ])\n+\n+    n_samples, n_features = X1.shape\n+    imputer = Imputer(missing_values=-1, strategy='mean', axis=0)\n+    imputer_with_in = clone(imputer).set_params(add_indicator_features=True)\n+    imputer.fit(X1)\n+    imputer_with_in.fit(X1)\n+    Xt = imputer.transform(X2)\n+    Xt_with_in = imputer_with_in.transform(X2)\n+    imputed_features_mask = X2[:, imputer.imputed_features_] == -1\n+    n_features_new = Xt.shape[1]\n+    n_imputed_features = len(imputer.imputed_features_)\n+    assert_equal(Xt_with_in.shape,\n+                 (n_samples, n_features_new + n_imputed_features))\n+    assert_array_equal(Xt_with_in, np.hstack((Xt, imputed_features_mask)))\n+    assert_array_equal(Xt_with_in,\n+                       imputer_with_in.transform(sparse.csc_matrix(X2)).A)\n+    assert_array_equal(Xt_with_in,","path":"sklearn/preprocessing/tests/test_imputation.py","position":110,"original_position":110,"commit_id":"d0bd95a78c063d37568aad70964a18688d727d87","original_commit_id":"d0bd95a78c063d37568aad70964a18688d727d87","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":"Is this assertion duplicated?","created_at":"2016-05-29T14:19:28Z","updated_at":"2016-05-29T14:19:28Z","html_url":"https://github.com/scikit-learn/scikit-learn/pull/6782#discussion_r65005703","pull_request_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/6782","_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/65005703"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/6782#discussion_r65005703"},"pull_request":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/6782"}}},"pull_request":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/6782","id":70097790,"html_url":"https://github.com/scikit-learn/scikit-learn/pull/6782","diff_url":"https://github.com/scikit-learn/scikit-learn/pull/6782.diff","patch_url":"https://github.com/scikit-learn/scikit-learn/pull/6782.patch","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6782","number":6782,"state":"open","locked":false,"title":"FIX: Imputer fix for indicator_matrix in add_indicator_features option","user":{"login":"maniteja123","id":6291963,"avatar_url":"https://avatars.githubusercontent.com/u/6291963?v=3","gravatar_id":"","url":"https://api.github.com/users/maniteja123","html_url":"https://github.com/maniteja123","followers_url":"https://api.github.com/users/maniteja123/followers","following_url":"https://api.github.com/users/maniteja123/following{/other_user}","gists_url":"https://api.github.com/users/maniteja123/gists{/gist_id}","starred_url":"https://api.github.com/users/maniteja123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maniteja123/subscriptions","organizations_url":"https://api.github.com/users/maniteja123/orgs","repos_url":"https://api.github.com/users/maniteja123/repos","events_url":"https://api.github.com/users/maniteja123/events{/privacy}","received_events_url":"https://api.github.com/users/maniteja123/received_events","type":"User","site_admin":false},"body":"#### Reference Issue\r\nFixes #6767 \r\n\r\n#### What does this implement/fix? Explain your changes.\r\nImputer ``add_indicator_features`` depends on the ``fit`` input for the indicator matrix and should be irrespective of the transform input.\r\n\r\n#### Any other comments?\r\nI have done many changes in the code, but the tests are passing. So please let me know if I changed something incorrectly.\r\n","created_at":"2016-05-14T17:01:00Z","updated_at":"2016-05-29T14:19:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"602934f459d7ed7ceb5c7cd864cb0eadd9b1b135","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/6782/commits","review_comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/6782/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/6782/comments","statuses_url":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/d0bd95a78c063d37568aad70964a18688d727d87","head":{"label":"maniteja123:imputer_fix","ref":"imputer_fix","sha":"d0bd95a78c063d37568aad70964a18688d727d87","user":{"login":"maniteja123","id":6291963,"avatar_url":"https://avatars.githubusercontent.com/u/6291963?v=3","gravatar_id":"","url":"https://api.github.com/users/maniteja123","html_url":"https://github.com/maniteja123","followers_url":"https://api.github.com/users/maniteja123/followers","following_url":"https://api.github.com/users/maniteja123/following{/other_user}","gists_url":"https://api.github.com/users/maniteja123/gists{/gist_id}","starred_url":"https://api.github.com/users/maniteja123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maniteja123/subscriptions","organizations_url":"https://api.github.com/users/maniteja123/orgs","repos_url":"https://api.github.com/users/maniteja123/repos","events_url":"https://api.github.com/users/maniteja123/events{/privacy}","received_events_url":"https://api.github.com/users/maniteja123/received_events","type":"User","site_admin":false},"repo":{"id":25398323,"name":"scikit-learn","full_name":"maniteja123/scikit-learn","owner":{"login":"maniteja123","id":6291963,"avatar_url":"https://avatars.githubusercontent.com/u/6291963?v=3","gravatar_id":"","url":"https://api.github.com/users/maniteja123","html_url":"https://github.com/maniteja123","followers_url":"https://api.github.com/users/maniteja123/followers","following_url":"https://api.github.com/users/maniteja123/following{/other_user}","gists_url":"https://api.github.com/users/maniteja123/gists{/gist_id}","starred_url":"https://api.github.com/users/maniteja123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maniteja123/subscriptions","organizations_url":"https://api.github.com/users/maniteja123/orgs","repos_url":"https://api.github.com/users/maniteja123/repos","events_url":"https://api.github.com/users/maniteja123/events{/privacy}","received_events_url":"https://api.github.com/users/maniteja123/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/maniteja123/scikit-learn","description":"scikit-learn: machine learning in Python","fork":true,"url":"https://api.github.com/repos/maniteja123/scikit-learn","forks_url":"https://api.github.com/repos/maniteja123/scikit-learn/forks","keys_url":"https://api.github.com/repos/maniteja123/scikit-learn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/maniteja123/scikit-learn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/maniteja123/scikit-learn/teams","hooks_url":"https://api.github.com/repos/maniteja123/scikit-learn/hooks","issue_events_url":"https://api.github.com/repos/maniteja123/scikit-learn/issues/events{/number}","events_url":"https://api.github.com/repos/maniteja123/scikit-learn/events","assignees_url":"https://api.github.com/repos/maniteja123/scikit-learn/assignees{/user}","branches_url":"https://api.github.com/repos/maniteja123/scikit-learn/branches{/branch}","tags_url":"https://api.github.com/repos/maniteja123/scikit-learn/tags","blobs_url":"https://api.github.com/repos/maniteja123/scikit-learn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/maniteja123/scikit-learn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/maniteja123/scikit-learn/git/refs{/sha}","trees_url":"https://api.github.com/repos/maniteja123/scikit-learn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/maniteja123/scikit-learn/statuses/{sha}","languages_url":"https://api.github.com/repos/maniteja123/scikit-learn/languages","stargazers_url":"https://api.github.com/repos/maniteja123/scikit-learn/stargazers","contributors_url":"https://api.github.com/repos/maniteja123/scikit-learn/contributors","subscribers_url":"https://api.github.com/repos/maniteja123/scikit-learn/subscribers","subscription_url":"https://api.github.com/repos/maniteja123/scikit-learn/subscription","commits_url":"https://api.github.com/repos/maniteja123/scikit-learn/commits{/sha}","git_commits_url":"https://api.github.com/repos/maniteja123/scikit-learn/git/commits{/sha}","comments_url":"https://api.github.com/repos/maniteja123/scikit-learn/comments{/number}","issue_comment_url":"https://api.github.com/repos/maniteja123/scikit-learn/issues/comments{/number}","contents_url":"https://api.github.com/repos/maniteja123/scikit-learn/contents/{+path}","compare_url":"https://api.github.com/repos/maniteja123/scikit-learn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/maniteja123/scikit-learn/merges","archive_url":"https://api.github.com/repos/maniteja123/scikit-learn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/maniteja123/scikit-learn/downloads","issues_url":"https://api.github.com/repos/maniteja123/scikit-learn/issues{/number}","pulls_url":"https://api.github.com/repos/maniteja123/scikit-learn/pulls{/number}","milestones_url":"https://api.github.com/repos/maniteja123/scikit-learn/milestones{/number}","notifications_url":"https://api.github.com/repos/maniteja123/scikit-learn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/maniteja123/scikit-learn/labels{/name}","releases_url":"https://api.github.com/repos/maniteja123/scikit-learn/releases{/id}","deployments_url":"https://api.github.com/repos/maniteja123/scikit-learn/deployments","created_at":"2014-10-18T13:39:05Z","updated_at":"2016-01-15T07:58:12Z","pushed_at":"2016-05-26T13:00:14Z","git_url":"git://github.com/maniteja123/scikit-learn.git","ssh_url":"git@github.com:maniteja123/scikit-learn.git","clone_url":"https://github.com/maniteja123/scikit-learn.git","svn_url":"https://github.com/maniteja123/scikit-learn","homepage":"http://scikit-learn.org","size":75206,"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":"417788c6a54c39614b82acf1a04b1f97f8a32199","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-05-29T13:27:33Z","pushed_at":"2016-05-29T13:56:25Z","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":123381,"stargazers_count":11616,"watchers_count":11616,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6763,"mirror_url":null,"open_issues_count":1200,"forks":6763,"open_issues":1200,"watchers":11616,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/6782"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/6782"},"issue":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6782"},"comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6782/comments"},"review_comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/6782/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/6782/commits"},"statuses":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/d0bd95a78c063d37568aad70964a18688d727d87"}}}}
{"actor":{"display_login":"jnothman"}}