{"action":"created","comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/37009020","id":37009020,"diff_hunk":"@@ -204,42 +209,44 @@ def partial_fit(self, X, y=None):\n         else:\n             self.n_components_ = self.n_components\n \n-        if (self.components_ is not None) and (self.components_.shape[0]\n-                                               != self.n_components_):\n+        if (self.components_ is not None) and (self.components_.shape[0] !=\n+                                               self.n_components_):\n             raise ValueError(\"Number of input features has changed from %i \"\n                              \"to %i between calls to partial_fit! Try \"\n-                             \"setting n_components to a fixed value.\" % (\n-                                 self.components_.shape[0], self.n_components_))\n+                             \"setting n_components to a fixed value.\" %\n+                             (self.components_.shape[0], self.n_components_))\n \n+        # This is the first partial_fit","path":"sklearn/decomposition/incremental_pca.py","position":52,"original_position":52,"commit_id":"a18956775114e2eecd3320c0af3ce78527539cd7","original_commit_id":"a18956775114e2eecd3320c0af3ce78527539cd7","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":"I don't remember what the consensus was wrt calling ``fit`` and then ``partial_fit``. Should we forget the model? I think there are some arguments about that in #3907.","created_at":"2015-08-13T18:33:22Z","updated_at":"2015-08-13T18:33:22Z","html_url":"https://github.com/scikit-learn/scikit-learn/pull/5104#discussion_r37009020","pull_request_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5104","_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/37009020"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/5104#discussion_r37009020"},"pull_request":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5104"}}},"pull_request":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5104","id":42014790,"html_url":"https://github.com/scikit-learn/scikit-learn/pull/5104","diff_url":"https://github.com/scikit-learn/scikit-learn/pull/5104.diff","patch_url":"https://github.com/scikit-learn/scikit-learn/pull/5104.patch","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/5104","number":5104,"state":"open","locked":false,"title":"[WIP] partial_fit for StandardScaler","user":{"login":"giorgiop","id":2871319,"avatar_url":"https://avatars.githubusercontent.com/u/2871319?v=3","gravatar_id":"","url":"https://api.github.com/users/giorgiop","html_url":"https://github.com/giorgiop","followers_url":"https://api.github.com/users/giorgiop/followers","following_url":"https://api.github.com/users/giorgiop/following{/other_user}","gists_url":"https://api.github.com/users/giorgiop/gists{/gist_id}","starred_url":"https://api.github.com/users/giorgiop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giorgiop/subscriptions","organizations_url":"https://api.github.com/users/giorgiop/orgs","repos_url":"https://api.github.com/users/giorgiop/repos","events_url":"https://api.github.com/users/giorgiop/events{/privacy}","received_events_url":"https://api.github.com/users/giorgiop/received_events","type":"User","site_admin":false},"body":"I am fixing #5028. This is only about `StandardScaler`. I moved the call to _handle_zeros_in_scale into `trasform` and `inverse_trasform`. This is necessary since otherwise we lose the true value of std (and var) that is needed for incremental computation —or otherwise we would need an additional variable only for that, which is not very elegant. Incidentally, this addresses #4609. I have also slightly extended `utils.extmath._batch_mean_variance_update` and did some refactoring in `decomposition.incremental_PCA`, that calls the former. \r\n\r\nA more conceptual change is the following. `partial_fit` must interpret an 1d array as a row matrix, i.e. must be able to process batches of size 1. This clashes with the behaviour of `fit` which by default assumes that 1d input arrays are column matrices. I think this is a design issue that should be tackled more generally, hence out of scope of this PR. See for example #4511. @GaelVaroquaux may want to comment here.\r\n\r\nI have not written tests on the interplay of subsequent calls to `fit` and `partial_fit`, as the semantics does not seem defined yet. See #3896\r\n\r\nRelated open discussions:\r\n- scalers #2514\r\n- partial_fit #3907 #3896","created_at":"2015-08-10T12:31:26Z","updated_at":"2015-08-13T18:33:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"458c9ef54500a0a27c5574c728ceb5497ccae4ad","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5104/commits","review_comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5104/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/5104/comments","statuses_url":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/a18956775114e2eecd3320c0af3ce78527539cd7","head":{"label":"giorgiop:scaler-partial-fit","ref":"scaler-partial-fit","sha":"a18956775114e2eecd3320c0af3ce78527539cd7","user":{"login":"giorgiop","id":2871319,"avatar_url":"https://avatars.githubusercontent.com/u/2871319?v=3","gravatar_id":"","url":"https://api.github.com/users/giorgiop","html_url":"https://github.com/giorgiop","followers_url":"https://api.github.com/users/giorgiop/followers","following_url":"https://api.github.com/users/giorgiop/following{/other_user}","gists_url":"https://api.github.com/users/giorgiop/gists{/gist_id}","starred_url":"https://api.github.com/users/giorgiop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giorgiop/subscriptions","organizations_url":"https://api.github.com/users/giorgiop/orgs","repos_url":"https://api.github.com/users/giorgiop/repos","events_url":"https://api.github.com/users/giorgiop/events{/privacy}","received_events_url":"https://api.github.com/users/giorgiop/received_events","type":"User","site_admin":false},"repo":{"id":34982360,"name":"scikit-learn","full_name":"giorgiop/scikit-learn","owner":{"login":"giorgiop","id":2871319,"avatar_url":"https://avatars.githubusercontent.com/u/2871319?v=3","gravatar_id":"","url":"https://api.github.com/users/giorgiop","html_url":"https://github.com/giorgiop","followers_url":"https://api.github.com/users/giorgiop/followers","following_url":"https://api.github.com/users/giorgiop/following{/other_user}","gists_url":"https://api.github.com/users/giorgiop/gists{/gist_id}","starred_url":"https://api.github.com/users/giorgiop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giorgiop/subscriptions","organizations_url":"https://api.github.com/users/giorgiop/orgs","repos_url":"https://api.github.com/users/giorgiop/repos","events_url":"https://api.github.com/users/giorgiop/events{/privacy}","received_events_url":"https://api.github.com/users/giorgiop/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/giorgiop/scikit-learn","description":"scikit-learn: machine learning in Python","fork":true,"url":"https://api.github.com/repos/giorgiop/scikit-learn","forks_url":"https://api.github.com/repos/giorgiop/scikit-learn/forks","keys_url":"https://api.github.com/repos/giorgiop/scikit-learn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/giorgiop/scikit-learn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/giorgiop/scikit-learn/teams","hooks_url":"https://api.github.com/repos/giorgiop/scikit-learn/hooks","issue_events_url":"https://api.github.com/repos/giorgiop/scikit-learn/issues/events{/number}","events_url":"https://api.github.com/repos/giorgiop/scikit-learn/events","assignees_url":"https://api.github.com/repos/giorgiop/scikit-learn/assignees{/user}","branches_url":"https://api.github.com/repos/giorgiop/scikit-learn/branches{/branch}","tags_url":"https://api.github.com/repos/giorgiop/scikit-learn/tags","blobs_url":"https://api.github.com/repos/giorgiop/scikit-learn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/giorgiop/scikit-learn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/giorgiop/scikit-learn/git/refs{/sha}","trees_url":"https://api.github.com/repos/giorgiop/scikit-learn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/giorgiop/scikit-learn/statuses/{sha}","languages_url":"https://api.github.com/repos/giorgiop/scikit-learn/languages","stargazers_url":"https://api.github.com/repos/giorgiop/scikit-learn/stargazers","contributors_url":"https://api.github.com/repos/giorgiop/scikit-learn/contributors","subscribers_url":"https://api.github.com/repos/giorgiop/scikit-learn/subscribers","subscription_url":"https://api.github.com/repos/giorgiop/scikit-learn/subscription","commits_url":"https://api.github.com/repos/giorgiop/scikit-learn/commits{/sha}","git_commits_url":"https://api.github.com/repos/giorgiop/scikit-learn/git/commits{/sha}","comments_url":"https://api.github.com/repos/giorgiop/scikit-learn/comments{/number}","issue_comment_url":"https://api.github.com/repos/giorgiop/scikit-learn/issues/comments{/number}","contents_url":"https://api.github.com/repos/giorgiop/scikit-learn/contents/{+path}","compare_url":"https://api.github.com/repos/giorgiop/scikit-learn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/giorgiop/scikit-learn/merges","archive_url":"https://api.github.com/repos/giorgiop/scikit-learn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/giorgiop/scikit-learn/downloads","issues_url":"https://api.github.com/repos/giorgiop/scikit-learn/issues{/number}","pulls_url":"https://api.github.com/repos/giorgiop/scikit-learn/pulls{/number}","milestones_url":"https://api.github.com/repos/giorgiop/scikit-learn/milestones{/number}","notifications_url":"https://api.github.com/repos/giorgiop/scikit-learn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/giorgiop/scikit-learn/labels{/name}","releases_url":"https://api.github.com/repos/giorgiop/scikit-learn/releases{/id}","created_at":"2015-05-03T10:39:46Z","updated_at":"2015-08-08T17:14:28Z","pushed_at":"2015-08-10T17:08:09Z","git_url":"git://github.com/giorgiop/scikit-learn.git","ssh_url":"git@github.com:giorgiop/scikit-learn.git","clone_url":"https://github.com/giorgiop/scikit-learn.git","svn_url":"https://github.com/giorgiop/scikit-learn","homepage":"http://scikit-learn.org","size":64276,"stargazers_count":1,"watchers_count":1,"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":1,"default_branch":"master"}},"base":{"label":"scikit-learn:master","ref":"master","sha":"1a45b79bb5693b1ad1ad8d10a9530db1b62fe2b6","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-08-13T17:05:28Z","pushed_at":"2015-08-13T18:32:16Z","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":129984,"stargazers_count":7142,"watchers_count":7142,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4236,"mirror_url":null,"open_issues_count":766,"forks":4236,"open_issues":766,"watchers":7142,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5104"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/5104"},"issue":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/5104"},"comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/5104/comments"},"review_comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5104/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/5104/commits"},"statuses":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/a18956775114e2eecd3320c0af3ce78527539cd7"}}}}