Skip to content

Commit

Permalink
Update test_PCA equivalence test to use svd_solver='full'
Browse files Browse the repository at this point in the history
  • Loading branch information
RichieHakim authored Aug 18, 2024
1 parent b6cb5a7 commit 966db78
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bnpm/tests/test_PCA.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

def test_fit_transform_equivalence():
n_components = 5
pca_sklearn = sklearnPCA(n_components=n_components).fit(X_np)
pca_sklearn = sklearnPCA(n_components=n_components, svd_solver='full').fit(X_np)
pca_torch = PCA(n_components=n_components).fit(X_torch)

# Compare the principal components directly
Expand Down Expand Up @@ -179,4 +179,4 @@ def test_n_components_effect():
pca_n.fit(X_torch)

assert pca_n.components_.shape[0] == n, f"PCA with n_components={n} did not produce the correct number of components."
assert pca_n.explained_variance_.shape[0] == n, f"PCA with n_components={n} did not produce the correct number of explained variances."
assert pca_n.explained_variance_.shape[0] == n, f"PCA with n_components={n} did not produce the correct number of explained variances."

0 comments on commit 966db78

Please sign in to comment.