8000 TST improve coverage of fastica function by NicolasHug · Pull Request #15102 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

TST improve coverage of fastica function #15102

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 1 commit into from
Sep 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions sklearn/decomposition/tests/test_fastica.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,3 +280,22 @@ def test_fastica_errors():
with pytest.raises(ValueError, match='Invalid algorithm.+must '
'be.+parallel.+or.+deflation'):
fastica(X, algorithm='pizza')


@pytest.mark.parametrize('whiten', [True, False])
@pytest.mark.parametrize('return_X_mean', [True, False])
@pytest.mark.parametrize('return_n_iter', [True, False])
def test_fastica_output_shape(whiten, return_X_mean, return_n_iter):
n_features = 3
n_samples = 10
rng = np.random.RandomState(0)
X = rng.random_sample((n_samples, n_features))

expected_len = 3 + return_X_mean + return_n_iter

out = fastica(X, whiten=whiten, return_n_iter=return_n_iter,
return_X_mean=return_X_mean)

assert len(out) == expected_len
if not whiten:
assert out[0] is None
0