Skip to content

Commit

Permalink
add test with sparse data
Browse files Browse the repository at this point in the history
  • Loading branch information
agramfort committed Dec 14, 2013
1 parent 2b8d06b commit 0553bf1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sklearn/decomposition/tests/test_pca.py
Expand Up @@ -118,6 +118,14 @@ def test_explained_variance():
assert_almost_equal(rpca.explained_variance_,
np.var(X_rpca, axis=0))

# Compare with RandomizedPCA using sparse data
X = csr_matrix(X)
rpca = assert_warns(DeprecationWarning, rpca.fit, X)
assert_array_almost_equal(pca.explained_variance_,
rpca.explained_variance_, 1)
assert_array_almost_equal(pca.explained_variance_ratio_,
rpca.explained_variance_ratio_, 3)


def test_pca_check_projection():
"""Test that the projection of data is correct"""
Expand Down

0 comments on commit 0553bf1

Please sign in to comment.