{"action":"created","comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/32062134","id":32062134,"diff_hunk":"@@ -430,6 +440,126 @@ def inverse_transform(self, X, copy=None):\n         return X\n \n \n+class MaxAbsScaler(BaseEstimator, TransformerMixin):\n+    \"\"\"Scale each feature to the [-1, 1] range without breaking the sparsity.\n+\n+    This estimator scales and translates each feature individually such\n+    that the maximal absolute value of each feature in the\n+    training set will be 1.0.\n+\n+    This scaler can also be applied to sparse CSR or CSC matrices.\n+\n+    Parameters\n+    ----------\n+    copy : boolean, optional, default is True\n+        Set to False to perform inplace scaling and avoid a copy (if the input\n+        is already a numpy array).\n+\n+    Attributes\n+    ----------\n+    `scale_` : ndarray, shape (n_features,)\n+        Per feature relative scaling of the data.\n+    \"\"\"\n+\n+    def __init__(self, copy=True):\n+        self.copy = copy\n+\n+    def fit(self, X, y=None):\n+        \"\"\"Compute the minimum and maximum to be used for later scaling.\n+\n+        Parameters\n+        ----------\n+        X : array-like, shape [n_samples, n_features]\n+            The data used to compute the per-feature minimum and maximum\n+            used for later scaling along the features axis.\n+        \"\"\"\n+        X = check_array(X, accept_sparse=('csr', 'csc'), copy=self.copy,\n+                        ensure_2d=False, warn_on_dtype=True,","path":"sklearn/preprocessing/data.py","position":119,"original_position":118,"commit_id":"5965d49b084c579b3d7c0aba7bb1195d0b6635ca","original_commit_id":"ef957613a4d3e05981e5347f41bdb6b9aca2cbf6","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":"That is the default in scikit-learn. We only warn in StandardScaler because previously we didn't convert.","created_at":"2015-06-09T20:49:19Z","updated_at":"2015-06-09T20:49:19Z","html_url":"https://github.com/scikit-learn/scikit-learn/pull/4828#discussion_r32062134","pull_request_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/4828","_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/32062134"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/4828#discussion_r32062134"},"pull_request":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/4828"}}},"pull_request":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/4828","id":37103049,"html_url":"https://github.com/scikit-learn/scikit-learn/pull/4828","diff_url":"https://github.com/scikit-learn/scikit-learn/pull/4828.diff","patch_url":"https://github.com/scikit-learn/scikit-learn/pull/4828.patch","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/4828","number":4828,"state":"open","locked":false,"title":"[MRG] add MaxAbsScaler","user":{"login":"untom","id":3627551,"avatar_url":"https://avatars.githubusercontent.com/u/3627551?v=3","gravatar_id":"","url":"https://api.github.com/users/untom","html_url":"https://github.com/untom","followers_url":"https://api.github.com/users/untom/followers","following_url":"https://api.github.com/users/untom/following{/other_user}","gists_url":"https://api.github.com/users/untom/gists{/gist_id}","starred_url":"https://api.github.com/users/untom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/untom/subscriptions","organizations_url":"https://api.github.com/users/untom/orgs","repos_url":"https://api.github.com/users/untom/repos","events_url":"https://api.github.com/users/untom/events{/privacy}","received_events_url":"https://api.github.com/users/untom/received_events","type":"User","site_admin":false},"body":"This PR adds the ``MaxAbsScaler`` and ``maxabs_scale`` to ``sklearn.preprocessing``. This scaler scales its inputs by the maximum absolute value of each feature. This scaler is especially useful for sparse data, but is probably also always a better alternative to ``MinMaxScaler`` when the data is already centered.\r\n\r\nThe scaler itself was previously discussed in #1799 and #2514.","created_at":"2015-06-07T07:55:26Z","updated_at":"2015-06-09T20:49:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b5ff05aea7fe1cfcbc52f93128cff3a9f9119d29","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/4828/commits","review_comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/4828/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/4828/comments","statuses_url":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/5965d49b084c579b3d7c0aba7bb1195d0b6635ca","head":{"label":"untom:maxabs_scaler","ref":"maxabs_scaler","sha":"5965d49b084c579b3d7c0aba7bb1195d0b6635ca","user":{"login":"untom","id":3627551,"avatar_url":"https://avatars.githubusercontent.com/u/3627551?v=3","gravatar_id":"","url":"https://api.github.com/users/untom","html_url":"https://github.com/untom","followers_url":"https://api.github.com/users/untom/followers","following_url":"https://api.github.com/users/untom/following{/other_user}","gists_url":"https://api.github.com/users/untom/gists{/gist_id}","starred_url":"https://api.github.com/users/untom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/untom/subscriptions","organizations_url":"https://api.github.com/users/untom/orgs","repos_url":"https://api.github.com/users/untom/repos","events_url":"https://api.github.com/users/untom/events{/privacy}","received_events_url":"https://api.github.com/users/untom/received_events","type":"User","site_admin":false},"repo":{"id":12777310,"name":"scikit-learn","full_name":"untom/scikit-learn","owner":{"login":"untom","id":3627551,"avatar_url":"https://avatars.githubusercontent.com/u/3627551?v=3","gravatar_id":"","url":"https://api.github.com/users/untom","html_url":"https://github.com/untom","followers_url":"https://api.github.com/users/untom/followers","following_url":"https://api.github.com/users/untom/following{/other_user}","gists_url":"https://api.github.com/users/untom/gists{/gist_id}","starred_url":"https://api.github.com/users/untom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/untom/subscriptions","organizations_url":"https://api.github.com/users/untom/orgs","repos_url":"https://api.github.com/users/untom/repos","events_url":"https://api.github.com/users/untom/events{/privacy}","received_events_url":"https://api.github.com/users/untom/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/untom/scikit-learn","description":"scikit-learn: machine learning in Python","fork":true,"url":"https://api.github.com/repos/untom/scikit-learn","forks_url":"https://api.github.com/repos/untom/scikit-learn/forks","keys_url":"https://api.github.com/repos/untom/scikit-learn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/untom/scikit-learn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/untom/scikit-learn/teams","hooks_url":"https://api.github.com/repos/untom/scikit-learn/hooks","issue_events_url":"https://api.github.com/repos/untom/scikit-learn/issues/events{/number}","events_url":"https://api.github.com/repos/untom/scikit-learn/events","assignees_url":"https://api.github.com/repos/untom/scikit-learn/assignees{/user}","branches_url":"https://api.github.com/repos/untom/scikit-learn/branches{/branch}","tags_url":"https://api.github.com/repos/untom/scikit-learn/tags","blobs_url":"https://api.github.com/repos/untom/scikit-learn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/untom/scikit-learn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/untom/scikit-learn/git/refs{/sha}","trees_url":"https://api.github.com/repos/untom/scikit-learn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/untom/scikit-learn/statuses/{sha}","languages_url":"https://api.github.com/repos/untom/scikit-learn/languages","stargazers_url":"https://api.github.com/repos/untom/scikit-learn/stargazers","contributors_url":"https://api.github.com/repos/untom/scikit-learn/contributors","subscribers_url":"https://api.github.com/repos/untom/scikit-learn/subscribers","subscription_url":"https://api.github.com/repos/untom/scikit-learn/subscription","commits_url":"https://api.github.com/repos/untom/scikit-learn/commits{/sha}","git_commits_url":"https://api.github.com/repos/untom/scikit-learn/git/commits{/sha}","comments_url":"https://api.github.com/repos/untom/scikit-learn/comments{/number}","issue_comment_url":"https://api.github.com/repos/untom/scikit-learn/issues/comments{/number}","contents_url":"https://api.github.com/repos/untom/scikit-learn/contents/{+path}","compare_url":"https://api.github.com/repos/untom/scikit-learn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/untom/scikit-learn/merges","archive_url":"https://api.github.com/repos/untom/scikit-learn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/untom/scikit-learn/downloads","issues_url":"https://api.github.com/repos/untom/scikit-learn/issues{/number}","pulls_url":"https://api.github.com/repos/untom/scikit-learn/pulls{/number}","milestones_url":"https://api.github.com/repos/untom/scikit-learn/milestones{/number}","notifications_url":"https://api.github.com/repos/untom/scikit-learn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/untom/scikit-learn/labels{/name}","releases_url":"https://api.github.com/repos/untom/scikit-learn/releases{/id}","created_at":"2013-09-12T07:09:51Z","updated_at":"2015-03-31T08:12:21Z","pushed_at":"2015-06-09T16:26:38Z","git_url":"git://github.com/untom/scikit-learn.git","ssh_url":"git@github.com:untom/scikit-learn.git","clone_url":"https://github.com/untom/scikit-learn.git","svn_url":"https://github.com/untom/scikit-learn","homepage":"http://scikit-learn.org","size":62531,"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":"32b2f8e5921175803b6d68f2a08ad1f1dbd55178","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-06-09T19:38:36Z","pushed_at":"2015-06-09T20:36:03Z","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":123841,"stargazers_count":6347,"watchers_count":6347,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3810,"mirror_url":null,"open_issues_count":678,"forks":3810,"open_issues":678,"watchers":6347,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/4828"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/4828"},"issue":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/4828"},"comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/4828/comments"},"review_comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/4828/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/4828/commits"},"statuses":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/5965d49b084c579b3d7c0aba7bb1195d0b6635ca"}}}}