Skip to content

Commit 123c318

Browse files
committed
use scipy.linalg in test_nmf.py
1 parent f7e0023 commit 123c318

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sklearn/decomposition/tests/test_nmf.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import numpy as np
2+
from scipy import linalg
23
from sklearn.decomposition import nmf
34

45
from sklearn.utils.testing import assert_true
@@ -33,8 +34,8 @@ def test_initialize_close():
3334
"""
3435
A = np.abs(random_state.randn(10, 10))
3536
W, H = nmf._initialize_nmf(A, 10)
36-
error = np.linalg.norm(np.dot(W, H) - A)
37-
sdev = np.linalg.norm(A - A.mean())
37+
error = linalg.norm(np.dot(W, H) - A)
38+
sdev = linalg.norm(A - A.mean())
3839
assert_true(error <= sdev)
3940

4041

@@ -147,7 +148,7 @@ def test_sparse_input():
147148
random_state=999)
148149
T2 = pg_nmf.fit_transform(A_sparse)
149150
assert_array_almost_equal(pg_nmf.reconstruction_err_,
150-
np.linalg.norm(A - np.dot(T2, pg_nmf.components_), 'fro'))
151+
linalg.norm(A - np.dot(T2, pg_nmf.components_), 'fro'))
151152
assert_array_almost_equal(T1, T2)
152153

153154
# same with sparseness

0 commit comments

Comments
 (0)