{"action":"created","comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/23338875","id":23338875,"diff_hunk":"@@ -138,8 +139,39 @@ def scale(X, axis=0, with_mean=True, with_std=True, copy=True):\n         Xr = np.rollaxis(X, axis)\n         if with_mean:\n             Xr -= mean_\n+            mean_1 = Xr.mean(axis=0)\n+            # Verify that mean_1 is 'close to zero'. If X contains very\n+            # large values, mean_1 can also be very large, due to a lack of\n+            # precision of mean_. In this case, a pre-scaling of the\n+            # concerned feature is efficient, for instance by its mean or\n+            # maximum.\n+            if isinstance(mean_1, np.ndarray):\n+                if not np.allclose(mean_1, np.zeros(np.shape(mean_1)[0])):","path":"sklearn/preprocessing/data.py","position":28,"original_position":28,"commit_id":"e0cc360ae8ee5d5198ba8ea42e1641d17c20a717","original_commit_id":"e0cc360ae8ee5d5198ba8ea42e1641d17c20a717","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":"you can just use ``np.allclose(mean_1, 0)``\r\n\r\n","created_at":"2015-01-21T22:07:54Z","updated_at":"2015-01-21T22:07:54Z","html_url":"https://github.com/scikit-learn/scikit-learn/pull/3747#discussion_r23338875","pull_request_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/3747","_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/23338875"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/3747#discussion_r23338875"},"pull_request":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/3747"}}},"pull_request":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/3747","id":22513514,"html_url":"https://github.com/scikit-learn/scikit-learn/pull/3747","diff_url":"https://github.com/scikit-learn/scikit-learn/pull/3747.diff","patch_url":"https://github.com/scikit-learn/scikit-learn/pull/3747.patch","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/3747","number":3747,"state":"open","locked":false,"title":"[MRG] Fix preprocessing.scale for arrays with near zero ratio variance/max","user":{"login":"ngoix","id":5682433,"avatar_url":"https://avatars.githubusercontent.com/u/5682433?v=3","gravatar_id":"","url":"https://api.github.com/users/ngoix","html_url":"https://github.com/ngoix","followers_url":"https://api.github.com/users/ngoix/followers","following_url":"https://api.github.com/users/ngoix/following{/other_user}","gists_url":"https://api.github.com/users/ngoix/gists{/gist_id}","starred_url":"https://api.github.com/users/ngoix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ngoix/subscriptions","organizations_url":"https://api.github.com/users/ngoix/orgs","repos_url":"https://api.github.com/users/ngoix/repos","events_url":"https://api.github.com/users/ngoix/events{/privacy}","received_events_url":"https://api.github.com/users/ngoix/received_events","type":"User","site_admin":false},"body":"Fix #3722, prolongating #3725.","created_at":"2014-10-09T18:29:35Z","updated_at":"2015-01-21T22:07:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"aa97a37e551901f1a5ab08d100cdd1dba18dac10","assignee":null,"milestone":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/milestones/12","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/milestones/12/labels","id":527004,"number":12,"title":"0.16","description":"","creator":{"login":"GaelVaroquaux","id":208217,"avatar_url":"https://avatars.githubusercontent.com/u/208217?v=3","gravatar_id":"","url":"https://api.github.com/users/GaelVaroquaux","html_url":"https://github.com/GaelVaroquaux","followers_url":"https://api.github.com/users/GaelVaroquaux/followers","following_url":"https://api.github.com/users/GaelVaroquaux/following{/other_user}","gists_url":"https://api.github.com/users/GaelVaroquaux/gists{/gist_id}","starred_url":"https://api.github.com/users/GaelVaroquaux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GaelVaroquaux/subscriptions","organizations_url":"https://api.github.com/users/GaelVaroquaux/orgs","repos_url":"https://api.github.com/users/GaelVaroquaux/repos","events_url":"https://api.github.com/users/GaelVaroquaux/events{/privacy}","received_events_url":"https://api.github.com/users/GaelVaroquaux/received_events","type":"User","site_admin":false},"open_issues":73,"closed_issues":14,"state":"open","created_at":"2014-01-05T21:19:20Z","updated_at":"2015-01-20T23:02:24Z","due_on":"2014-10-02T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/3747/commits","review_comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/3747/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/3747/comments","statuses_url":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/e0cc360ae8ee5d5198ba8ea42e1641d17c20a717","head":{"label":"ngoix:preproc","ref":"preproc","sha":"e0cc360ae8ee5d5198ba8ea42e1641d17c20a717","user":{"login":"ngoix","id":5682433,"avatar_url":"https://avatars.githubusercontent.com/u/5682433?v=3","gravatar_id":"","url":"https://api.github.com/users/ngoix","html_url":"https://github.com/ngoix","followers_url":"https://api.github.com/users/ngoix/followers","following_url":"https://api.github.com/users/ngoix/following{/other_user}","gists_url":"https://api.github.com/users/ngoix/gists{/gist_id}","starred_url":"https://api.github.com/users/ngoix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ngoix/subscriptions","organizations_url":"https://api.github.com/users/ngoix/orgs","repos_url":"https://api.github.com/users/ngoix/repos","events_url":"https://api.github.com/users/ngoix/events{/privacy}","received_events_url":"https://api.github.com/users/ngoix/received_events","type":"User","site_admin":false},"repo":{"id":20621109,"name":"scikit-learn","full_name":"ngoix/scikit-learn","owner":{"login":"ngoix","id":5682433,"avatar_url":"https://avatars.githubusercontent.com/u/5682433?v=3","gravatar_id":"","url":"https://api.github.com/users/ngoix","html_url":"https://github.com/ngoix","followers_url":"https://api.github.com/users/ngoix/followers","following_url":"https://api.github.com/users/ngoix/following{/other_user}","gists_url":"https://api.github.com/users/ngoix/gists{/gist_id}","starred_url":"https://api.github.com/users/ngoix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ngoix/subscriptions","organizations_url":"https://api.github.com/users/ngoix/orgs","repos_url":"https://api.github.com/users/ngoix/repos","events_url":"https://api.github.com/users/ngoix/events{/privacy}","received_events_url":"https://api.github.com/users/ngoix/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ngoix/scikit-learn","description":"scikit-learn: machine learning in Python","fork":true,"url":"https://api.github.com/repos/ngoix/scikit-learn","forks_url":"https://api.github.com/repos/ngoix/scikit-learn/forks","keys_url":"https://api.github.com/repos/ngoix/scikit-learn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ngoix/scikit-learn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ngoix/scikit-learn/teams","hooks_url":"https://api.github.com/repos/ngoix/scikit-learn/hooks","issue_events_url":"https://api.github.com/repos/ngoix/scikit-learn/issues/events{/number}","events_url":"https://api.github.com/repos/ngoix/scikit-learn/events","assignees_url":"https://api.github.com/repos/ngoix/scikit-learn/assignees{/user}","branches_url":"https://api.github.com/repos/ngoix/scikit-learn/branches{/branch}","tags_url":"https://api.github.com/repos/ngoix/scikit-learn/tags","blobs_url":"https://api.github.com/repos/ngoix/scikit-learn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ngoix/scikit-learn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ngoix/scikit-learn/git/refs{/sha}","trees_url":"https://api.github.com/repos/ngoix/scikit-learn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ngoix/scikit-learn/statuses/{sha}","languages_url":"https://api.github.com/repos/ngoix/scikit-learn/languages","stargazers_url":"https://api.github.com/repos/ngoix/scikit-learn/stargazers","contributors_url":"https://api.github.com/repos/ngoix/scikit-learn/contributors","subscribers_url":"https://api.github.com/repos/ngoix/scikit-learn/subscribers","subscription_url":"https://api.github.com/repos/ngoix/scikit-learn/subscription","commits_url":"https://api.github.com/repos/ngoix/scikit-learn/commits{/sha}","git_commits_url":"https://api.github.com/repos/ngoix/scikit-learn/git/commits{/sha}","comments_url":"https://api.github.com/repos/ngoix/scikit-learn/comments{/number}","issue_comment_url":"https://api.github.com/repos/ngoix/scikit-learn/issues/comments/{number}","contents_url":"https://api.github.com/repos/ngoix/scikit-learn/contents/{+path}","compare_url":"https://api.github.com/repos/ngoix/scikit-learn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ngoix/scikit-learn/merges","archive_url":"https://api.github.com/repos/ngoix/scikit-learn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ngoix/scikit-learn/downloads","issues_url":"https://api.github.com/repos/ngoix/scikit-learn/issues{/number}","pulls_url":"https://api.github.com/repos/ngoix/scikit-learn/pulls{/number}","milestones_url":"https://api.github.com/repos/ngoix/scikit-learn/milestones{/number}","notifications_url":"https://api.github.com/repos/ngoix/scikit-learn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ngoix/scikit-learn/labels{/name}","releases_url":"https://api.github.com/repos/ngoix/scikit-learn/releases{/id}","created_at":"2014-06-08T16:42:05Z","updated_at":"2015-01-10T16:14:44Z","pushed_at":"2015-01-10T16:14:42Z","git_url":"git://github.com/ngoix/scikit-learn.git","ssh_url":"git@github.com:ngoix/scikit-learn.git","clone_url":"https://github.com/ngoix/scikit-learn.git","svn_url":"https://github.com/ngoix/scikit-learn","homepage":"http://scikit-learn.org","size":57967,"stargazers_count":0,"watchers_count":0,"language":"C","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":"3f49cee020a91a0be5d0d5602d29b3eefce9d758","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-01-21T21:55:31Z","pushed_at":"2015-01-21T21:55:31Z","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":110318,"stargazers_count":4876,"watchers_count":4876,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2825,"mirror_url":null,"open_issues_count":573,"forks":2825,"open_issues":573,"watchers":4876,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/3747"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/3747"},"issue":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/3747"},"comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/3747/comments"},"review_comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/3747/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/3747/commits"},"statuses":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/e0cc360ae8ee5d5198ba8ea42e1641d17c20a717"}}}}