Skip to content

Commit 4bc4d23

Browse files
authored
ENH Use check_finite=False in sklearn.datasets (scikit-learn#18845)
1 parent 2ea49a6 commit 4bc4d23

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

sklearn/datasets/_samples_generator.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,8 +1156,10 @@ def make_low_rank_matrix(n_samples=100, n_features=100, *, effective_rank=10,
11561156
n = min(n_samples, n_features)
11571157

11581158
# Random (ortho normal) vectors
1159-
u, _ = linalg.qr(generator.randn(n_samples, n), mode='economic')
1160-
v, _ = linalg.qr(generator.randn(n_features, n), mode='economic')
1159+
u, _ = linalg.qr(generator.randn(n_samples, n), mode='economic',
1160+
check_finite=False)
1161+
v, _ = linalg.qr(generator.randn(n_features, n), mode='economic',
1162+
check_finite=False)
11611163

11621164
# Index of the singular values
11631165
singular_ind = np.arange(n, dtype=np.float64)
@@ -1315,7 +1317,7 @@ def make_spd_matrix(n_dim, *, random_state=None):
13151317
generator = check_random_state(random_state)
13161318

13171319
A = generator.rand(n_dim, n_dim)
1318-
U, _, Vt = linalg.svd(np.dot(A.T, A))
1320+
U, _, Vt = linalg.svd(np.dot(A.T, A), check_finite=False)
13191321
X = np.dot(np.dot(U, 1.0 + np.diag(generator.rand(n_dim))), Vt)
13201322

13211323
return X

0 commit comments

Comments
 (0)