{"action":"created","comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/42875235","id":42875235,"diff_hunk":"@@ -120,25 +124,68 @@ class PCA(BaseEstimator, TransformerMixin):\n \n             n_components == min(n_samples, n_features)\n \n-        if n_components == 'mle', Minka\\'s MLE is used to guess the dimension\n-        if ``0 < n_components < 1``, select the number of components such that\n-        the amount of variance that needs to be explained is greater than the\n-        percentage specified by n_components\n+        if n_components == 'mle' and svd_solver == 'full', Minka\\'s MLE is used\n+        to guess the dimension\n+        if ``0 < n_components < 1`` and svd_solver == 'full', select the number\n+        of components such that the amount of variance that needs to be\n+        explained is greater than the percentage specified by n_components\n+        n_components cannot be equal to n_features for svd_solver == 'arpack'.\n \n-    copy : bool\n+    copy : bool (default False)\n         If False, data passed to fit are overwritten and running\n         fit(X).transform(X) will not yield the expected results,\n         use fit_transform(X) instead.\n \n-    whiten : bool, optional\n-        When True (False by default) the `components_` vectors are divided\n-        by n_samples times singular values to ensure uncorrelated outputs\n-        with unit component-wise variances.\n+    whiten : bool, optional (default False)\n+        When True the `components_` vectors are divided by n_samples times\n+        singular values to ensure uncorrelated outputs with unit component-wise\n+        variances.\n \n         Whitening will remove some information from the transformed signal\n         (the relative variance scales of the components) but can sometime\n         improve the predictive accuracy of the downstream estimators by\n-        making there data respect some hard-wired assumptions.\n+        making their data respect some hard-wired assumptions.\n+\n+    svd_solver : string (default 'auto')\n+        The algorithm that runs SVD\n+        if svd_solver == 'full', run exact SVD calling LAPACK solver via\n+        `scipy.linalg.svd` and select the components by postprocessing\n+        if svd_solver == 'arpack', run SVD truncated to n_components calling\n+        ARPACK solver via `scipy.sparse.linalg.svds`. It requires strictly\n+        0 < n_components < X.shape[1]\n+        if svd_solver == 'randomized', run randomized SVD by the method of\n+        Halko et al.\n+        if svd_solver == 'auto':\n+            if n_components >= 1 and n_components < .1 * min(X.shape):\n+                svd_solver = 'arpack'\n+            elif n_components >= 1 and n_components < .8 * min(X.shape):\n+                svd_solver = 'randomized'\n+            else:\n+                svd_solver = 'full'","path":"sklearn/decomposition/pca.py","position":120,"original_position":120,"commit_id":"bce4982e16544b9658d58aecb514047458de498d","original_commit_id":"bce4982e16544b9658d58aecb514047458de498d","user":{"login":"ogrisel","id":89061,"avatar_url":"https://avatars.githubusercontent.com/u/89061?v=3","gravatar_id":"","url":"https://api.github.com/users/ogrisel","html_url":"https://github.com/ogrisel","followers_url":"https://api.github.com/users/ogrisel/followers","following_url":"https://api.github.com/users/ogrisel/following{/other_user}","gists_url":"https://api.github.com/users/ogrisel/gists{/gist_id}","starred_url":"https://api.github.com/users/ogrisel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ogrisel/subscriptions","organizations_url":"https://api.github.com/users/ogrisel/orgs","repos_url":"https://api.github.com/users/ogrisel/repos","events_url":"https://api.github.com/users/ogrisel/events{/privacy}","received_events_url":"https://api.github.com/users/ogrisel/received_events","type":"User","site_admin":false},"body":"What do you think about if:\r\n\r\n```python\r\nif max(X.shape) <= 500:  # use full exact solver on small problems\r\n     svd_solver = 'full'\r\nelif ...\r\n```\r\n\r\nat the top.","created_at":"2015-10-23T15:04:38Z","updated_at":"2015-10-23T15:04:38Z","html_url":"https://github.com/scikit-learn/scikit-learn/pull/5299#discussion_r42875235","pull_request_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5299","_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/42875235"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/5299#discussion_r42875235"},"pull_request":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5299"}}},"pull_request":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5299","id":45764207,"html_url":"https://github.com/scikit-learn/scikit-learn/pull/5299","diff_url":"https://github.com/scikit-learn/scikit-learn/pull/5299.diff","patch_url":"https://github.com/scikit-learn/scikit-learn/pull/5299.patch","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/5299","number":5299,"state":"open","locked":false,"title":"[MRG+1] Collapsing PCA and RandomizedPCA","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":"Fixes #5243  and #3930.\r\n\r\nto do\r\n- [x] collapse the two classes\r\n- [x] old tests passing\r\n- [x] integrate `svd_solver=='arpack'`\r\n- [x] benchmark the 3 solvers and establish the best `auto` policy\r\n- [x] fix docstrings\r\n- [x] uniform with `IncrementalPCA` by inheritance from `_BasePCA`; see  #3285\r\n- [x] ~~add `flip_sign` param, True by default~~ we flip by default, without introducing a param for controlling the behaviour\r\n- [x] arpack backport updated","created_at":"2015-09-23T10:34:04Z","updated_at":"2015-10-23T15:04:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1ac1d4a3905eff077be97a1624b0e2cee3531624","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5299/commits","review_comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5299/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/5299/comments","statuses_url":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/bce4982e16544b9658d58aecb514047458de498d","head":{"label":"giorgiop:pca+randomizedpca","ref":"pca+randomizedpca","sha":"bce4982e16544b9658d58aecb514047458de498d","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-09-08T14:16:19Z","pushed_at":"2015-10-23T14:10:17Z","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":69123,"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":"93c3033c1aaf21b760b4dbbfc120119a7f012e0c","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-10-23T10:06:42Z","pushed_at":"2015-10-23T14:57:22Z","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":142233,"stargazers_count":7956,"watchers_count":7956,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4740,"mirror_url":null,"open_issues_count":787,"forks":4740,"open_issues":787,"watchers":7956,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5299"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/5299"},"issue":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/5299"},"comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/5299/comments"},"review_comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5299/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/5299/commits"},"statuses":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/bce4982e16544b9658d58aecb514047458de498d"}}}}