Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[MRG+1] BUG: fix svd_solver validation in PCA.fit #8496

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 3, 2017

Conversation

jakevdp
Copy link
Member

@jakevdp jakevdp commented Mar 2, 2017

Minor issue: svd_solver argument was not being validated. This should fix it.

@jakevdp
Copy link
Member Author

jakevdp commented Mar 2, 2017

This is what alerted me to the bug:

import numpy as np
from sklearn.decomposition import PCA
X = np.random.rand(100, 3)
PCA(svd_solver='bad_argument').fit_transform(X)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-78-e2ffb2d1528d> in <module>()
      2 from sklearn.decomposition import PCA
      3 X = np.random.rand(100, 3)
----> 4 PCA(svd_solver='bad_argument').fit_transform(X)

/Users/jakevdp/anaconda/envs/python3.5/lib/python3.5/site-packages/sklearn/decomposition/pca.py in fit_transform(self, X, y)
    310 
    311         """
--> 312         U, S, V = self._fit(X)
    313         U = U[:, :self.n_components_]
    314 

TypeError: 'NoneType' object is not iterable

@codecov
Copy link

codecov bot commented Mar 2, 2017

Codecov Report

Merging #8496 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #8496      +/-   ##
==========================================
+ Coverage   95.47%   95.48%   +<.01%     
==========================================
  Files         342      342              
  Lines       60907    60912       +5     
==========================================
+ Hits        58154    58159       +5     
  Misses       2753     2753
Impacted Files Coverage Δ
sklearn/decomposition/pca.py 94.5% <100%> (+0.02%)
sklearn/decomposition/tests/test_pca.py 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bb3fc06...9aa4ef5. Read the comment docs.

@jakevdp
Copy link
Member Author

jakevdp commented Mar 2, 2017

Hmm... I guess I need a regression test here.

@jakevdp
Copy link
Member Author

jakevdp commented Mar 2, 2017

OK, good to go I think 😄

@jakevdp jakevdp changed the title BUG: fix svd_solver validation in PCA.fit [MRG} BUG: fix svd_solver validation in PCA.fit Mar 3, 2017
@jakevdp jakevdp changed the title [MRG} BUG: fix svd_solver validation in PCA.fit [MRG] BUG: fix svd_solver validation in PCA.fit Mar 3, 2017
@GaelVaroquaux GaelVaroquaux changed the title [MRG] BUG: fix svd_solver validation in PCA.fit [MRG+1] BUG: fix svd_solver validation in PCA.fit Mar 3, 2017
Copy link
Member

@GaelVaroquaux GaelVaroquaux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. +1 for merge

@TomDLT TomDLT merged commit f38231e into scikit-learn:master Mar 3, 2017
@jakevdp jakevdp deleted the fix-pca-validation branch March 3, 2017 15:57
@Przemo10 Przemo10 mentioned this pull request Mar 17, 2017
herilalaina pushed a commit to herilalaina/scikit-learn that referenced this pull request Mar 26, 2017
* BUG: fix svd_solver validation in PCA.fit

* TST: add test of pca svd_solver
massich pushed a commit to massich/scikit-learn that referenced this pull request Apr 26, 2017
* BUG: fix svd_solver validation in PCA.fit

* TST: add test of pca svd_solver
Sundrique pushed a commit to Sundrique/scikit-learn that referenced this pull request Jun 14, 2017
* BUG: fix svd_solver validation in PCA.fit

* TST: add test of pca svd_solver
NelleV pushed a commit to NelleV/scikit-learn that referenced this pull request Aug 11, 2017
* BUG: fix svd_solver validation in PCA.fit

* TST: add test of pca svd_solver
paulha pushed a commit to paulha/scikit-learn that referenced this pull request Aug 19, 2017
* BUG: fix svd_solver validation in PCA.fit

* TST: add test of pca svd_solver
maskani-moh pushed a commit to maskani-moh/scikit-learn that referenced this pull request Nov 15, 2017
* BUG: fix svd_solver validation in PCA.fit

* TST: add test of pca svd_solver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants