{"action":"created","comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/245341891","pull_request_review_id":189425792,"id":245341891,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0NTM0MTg5MQ==","diff_hunk":"@@ -848,3 +852,246 @@ def inverse_transform(self, X):\n             X_tr[:, i] = self.categories_[i][labels]\n \n         return X_tr\n+\n+\n+class UnaryEncoder(BaseEstimator, TransformerMixin):\n+    \"\"\"Encode ordinal integer features using a unary scheme.\n+\n+    This encoder transforms each ordinal feature with ``m`` possible values\n+    into ``m - 1`` binary features, where the ith feature is active if ``x >\n+    i``. The input to this transformer should be a matrix of non-negative\n+    integers, denoting the values taken on by the ordinal features.\n+\n+    This encoding may be needed for feeding ordinal features to many\n+    scikit-learn estimators, notably linear models and kernel-based models\n+    like SVMs with the standard kernels.\n+    This transformation is unlikely to help when using with tree-based models,\n+    since those already work on the basis of a particular feature value being\n+    less or greater than a threshold, unlike linear and kernel-based models.\n+\n+    This encoder encodes all of the features. To only encode a subset of the\n+    features, use :class:`ColumnTransformer\n+    <sklearn.compose.ColumnTransformer>`.\n+\n+    Read more in the :ref:`User Guide <unary_encoding>`.\n+\n+    Parameters\n+    ----------\n+    n_values : 'auto', int or array of ints, optional (default='auto')","path":"sklearn/preprocessing/_encoders.py","position":null,"original_position":47,"commit_id":"e1f2f3fbda64a6c14b8082357c9103897a6665d4","original_commit_id":"b4609fe13fde0fc17a131e8af699fadeff313cd9","user":{"login":"NicolasHug","id":1190450,"node_id":"MDQ6VXNlcjExOTA0NTA=","avatar_url":"https://avatars2.githubusercontent.com/u/1190450?v=4","gravatar_id":"","url":"https://api.github.com/users/NicolasHug","html_url":"https://github.com/NicolasHug","followers_url":"https://api.github.com/users/NicolasHug/followers","following_url":"https://api.github.com/users/NicolasHug/following{/other_user}","gists_url":"https://api.github.com/users/NicolasHug/gists{/gist_id}","starred_url":"https://api.github.com/users/NicolasHug/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NicolasHug/subscriptions","organizations_url":"https://api.github.com/users/NicolasHug/orgs","repos_url":"https://api.github.com/users/NicolasHug/repos","events_url":"https://api.github.com/users/NicolasHug/events{/privacy}","received_events_url":"https://api.github.com/users/NicolasHug/received_events","type":"User","site_admin":false},"body":"Ok I think this is a good idea too, just want input from @jnothman before reworking this","created_at":"2019-01-04T16:07:55Z","updated_at":"2019-01-04T16:07:55Z","html_url":"https://github.com/scikit-learn/scikit-learn/pull/12893#discussion_r245341891","pull_request_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/12893","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/245341891"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/12893#discussion_r245341891"},"pull_request":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/12893"}},"in_reply_to_id":244545752},"pull_request":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/12893","id":241509605,"node_id":"MDExOlB1bGxSZXF1ZXN0MjQxNTA5NjA1","html_url":"https://github.com/scikit-learn/scikit-learn/pull/12893","diff_url":"https://github.com/scikit-learn/scikit-learn/pull/12893.diff","patch_url":"https://github.com/scikit-learn/scikit-learn/pull/12893.patch","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/12893","number":12893,"state":"open","locked":false,"title":"[MRG] Unary encoder -- continued","user":{"login":"NicolasHug","id":1190450,"node_id":"MDQ6VXNlcjExOTA0NTA=","avatar_url":"https://avatars2.githubusercontent.com/u/1190450?v=4","gravatar_id":"","url":"https://api.github.com/users/NicolasHug","html_url":"https://github.com/NicolasHug","followers_url":"https://api.github.com/users/NicolasHug/followers","following_url":"https://api.github.com/users/NicolasHug/following{/other_user}","gists_url":"https://api.github.com/users/NicolasHug/gists{/gist_id}","starred_url":"https://api.github.com/users/NicolasHug/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NicolasHug/subscriptions","organizations_url":"https://api.github.com/users/NicolasHug/orgs","repos_url":"https://api.github.com/users/NicolasHug/repos","events_url":"https://api.github.com/users/NicolasHug/events{/privacy}","received_events_url":"https://api.github.com/users/NicolasHug/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\n#### Reference Issues/PRs\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\nCloses #8652 \r\n\r\n#### What does this implement/fix? Explain your changes.\r\n\r\nThis PR finishes the work in #8652 that implements a unary encoder.\r\n\r\nChanges from #8652:\r\n\r\n- Addressed review from @jorisvandenbossche \r\n- Addressed https://github.com/scikit-learn/scikit-learn/pull/8652#issuecomment-404358602: removed the `ordinal_features` parameter, and hence the calls to `transform_selected`\r\n- Add `inverse_transform`\r\n- Updated user guide\r\n\r\n\r\n**I haven't changed any of the existing tests**, nor added new ones (except for `inverse_transform`), considering that the original PR was already accepted by @jnothman.\r\n\r\n#### Any other comments?\r\n\r\nI have added some review/comments where I need additional input from reviewers.\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-12-30T21:28:58Z","updated_at":"2019-01-04T16:07:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7cab960c7f66352c02b7407ae5be4eacfa788612","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/12893/commits","review_comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/12893/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/12893/comments","statuses_url":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/e1f2f3fbda64a6c14b8082357c9103897a6665d4","head":{"label":"NicolasHug:unary_encoder_continued","ref":"unary_encoder_continued","sha":"e1f2f3fbda64a6c14b8082357c9103897a6665d4","user":{"login":"NicolasHug","id":1190450,"node_id":"MDQ6VXNlcjExOTA0NTA=","avatar_url":"https://avatars2.githubusercontent.com/u/1190450?v=4","gravatar_id":"","url":"https://api.github.com/users/NicolasHug","html_url":"https://github.com/NicolasHug","followers_url":"https://api.github.com/users/NicolasHug/followers","following_url":"https://api.github.com/users/NicolasHug/following{/other_user}","gists_url":"https://api.github.com/users/NicolasHug/gists{/gist_id}","starred_url":"https://api.github.com/users/NicolasHug/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NicolasHug/subscriptions","organizations_url":"https://api.github.com/users/NicolasHug/orgs","repos_url":"https://api.github.com/users/NicolasHug/repos","events_url":"https://api.github.com/users/NicolasHug/events{/privacy}","received_events_url":"https://api.github.com/users/NicolasHug/received_events","type":"User","site_admin":false},"repo":{"id":139458972,"node_id":"MDEwOlJlcG9zaXRvcnkxMzk0NTg5NzI=","name":"scikit-learn","full_name":"NicolasHug/scikit-learn","private":false,"owner":{"login":"NicolasHug","id":1190450,"node_id":"MDQ6VXNlcjExOTA0NTA=","avatar_url":"https://avatars2.githubusercontent.com/u/1190450?v=4","gravatar_id":"","url":"https://api.github.com/users/NicolasHug","html_url":"https://github.com/NicolasHug","followers_url":"https://api.github.com/users/NicolasHug/followers","following_url":"https://api.github.com/users/NicolasHug/following{/other_user}","gists_url":"https://api.github.com/users/NicolasHug/gists{/gist_id}","starred_url":"https://api.github.com/users/NicolasHug/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NicolasHug/subscriptions","organizations_url":"https://api.github.com/users/NicolasHug/orgs","repos_url":"https://api.github.com/users/NicolasHug/repos","events_url":"https://api.github.com/users/NicolasHug/events{/privacy}","received_events_url":"https://api.github.com/users/NicolasHug/received_events","type":"User","site_admin":false},"html_url":"https://github.com/NicolasHug/scikit-learn","description":"scikit-learn: machine learning in Python","fork":true,"url":"https://api.github.com/repos/NicolasHug/scikit-learn","forks_url":"https://api.github.com/repos/NicolasHug/scikit-learn/forks","keys_url":"https://api.github.com/repos/NicolasHug/scikit-learn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NicolasHug/scikit-learn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NicolasHug/scikit-learn/teams","hooks_url":"https://api.github.com/repos/NicolasHug/scikit-learn/hooks","issue_events_url":"https://api.github.com/repos/NicolasHug/scikit-learn/issues/events{/number}","events_url":"https://api.github.com/repos/NicolasHug/scikit-learn/events","assignees_url":"https://api.github.com/repos/NicolasHug/scikit-learn/assignees{/user}","branches_url":"https://api.github.com/repos/NicolasHug/scikit-learn/branches{/branch}","tags_url":"https://api.github.com/repos/NicolasHug/scikit-learn/tags","blobs_url":"https://api.github.com/repos/NicolasHug/scikit-learn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NicolasHug/scikit-learn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NicolasHug/scikit-learn/git/refs{/sha}","trees_url":"https://api.github.com/repos/NicolasHug/scikit-learn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NicolasHug/scikit-learn/statuses/{sha}","languages_url":"https://api.github.com/repos/NicolasHug/scikit-learn/languages","stargazers_url":"https://api.github.com/repos/NicolasHug/scikit-learn/stargazers","contributors_url":"https://api.github.com/repos/NicolasHug/scikit-learn/contributors","subscribers_url":"https://api.github.com/repos/NicolasHug/scikit-learn/subscribers","subscription_url":"https://api.github.com/repos/NicolasHug/scikit-learn/subscription","commits_url":"https://api.github.com/repos/NicolasHug/scikit-learn/commits{/sha}","git_commits_url":"https://api.github.com/repos/NicolasHug/scikit-learn/git/commits{/sha}","comments_url":"https://api.github.com/repos/NicolasHug/scikit-learn/comments{/number}","issue_comment_url":"https://api.github.com/repos/NicolasHug/scikit-learn/issues/comments{/number}","contents_url":"https://api.github.com/repos/NicolasHug/scikit-learn/contents/{+path}","compare_url":"https://api.github.com/repos/NicolasHug/scikit-learn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NicolasHug/scikit-learn/merges","archive_url":"https://api.github.com/repos/NicolasHug/scikit-learn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NicolasHug/scikit-learn/downloads","issues_url":"https://api.github.com/repos/NicolasHug/scikit-learn/issues{/number}","pulls_url":"https://api.github.com/repos/NicolasHug/scikit-learn/pulls{/number}","milestones_url":"https://api.github.com/repos/NicolasHug/scikit-learn/milestones{/number}","notifications_url":"https://api.github.com/repos/NicolasHug/scikit-learn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NicolasHug/scikit-learn/labels{/name}","releases_url":"https://api.github.com/repos/NicolasHug/scikit-learn/releases{/id}","deployments_url":"https://api.github.com/repos/NicolasHug/scikit-learn/deployments","created_at":"2018-07-02T15:07:27Z","updated_at":"2018-12-17T21:53:28Z","pushed_at":"2019-01-04T14:52:34Z","git_url":"git://github.com/NicolasHug/scikit-learn.git","ssh_url":"git@github.com:NicolasHug/scikit-learn.git","clone_url":"https://github.com/NicolasHug/scikit-learn.git","svn_url":"https://github.com/NicolasHug/scikit-learn","homepage":"http://scikit-learn.org","size":98014,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"scikit-learn:master","ref":"master","sha":"4223633b0d64c75fef1230f66cfb1d50fb5a8d04","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","private":false,"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},"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":"2019-01-04T15:50:45Z","pushed_at":"2019-01-04T15:38:28Z","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":98454,"stargazers_count":32635,"watchers_count":32635,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16074,"mirror_url":null,"archived":false,"open_issues_count":1885,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":16074,"open_issues":1885,"watchers":32635,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/12893"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/12893"},"issue":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/12893"},"comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/12893/comments"},"review_comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/12893/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/12893/commits"},"statuses":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/e1f2f3fbda64a6c14b8082357c9103897a6665d4"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"NicolasHug"}}