Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 24866a9

Browse files
author
giorgiop
committed
test_extmath
1 parent 21bdb19 commit 24866a9

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

sklearn/utils/tests/test_extmath.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def test_randomized_svd_infinite_rank():
225225

226226

227227
def test_randomized_svd_transpose_consistency():
228-
# Check that transposing the design matrix has limit impact
228+
# Check that transposing the design matrix has limited impact
229229
n_samples = 100
230230
n_features = 500
231231
rank = 4
@@ -261,7 +261,7 @@ def test_randomized_svd_power_iteration_normalizer():
261261
# randomized_svd with power_iteration_normalized='none' diverges for
262262
# large number of power iterations on this dataset
263263
rng = np.random.RandomState(42)
264-
X = make_low_rank_matrix(300, 1000, effective_rank=50, random_state=rng)
264+
X = make_low_rank_matrix(200, 900, effective_rank=50, random_state=rng)
265265
X += 3 * rng.randint(0, 2, size=X.shape)
266266
n_components = 50
267267

@@ -274,7 +274,6 @@ def test_randomized_svd_power_iteration_normalizer():
274274
power_iteration_normalizer='none')
275275
A = X - U.dot(np.diag(s).dot(V))
276276
error_20 = linalg.norm(A, ord='fro')
277-
print(error_2 - error_20)
278277
assert_greater(np.abs(error_2 - error_20), 100)
279278

280279
for normalizer in ['LU', 'QR', 'auto']:
@@ -288,7 +287,6 @@ def test_randomized_svd_power_iteration_normalizer():
288287
power_iteration_normalizer=normalizer)
289288
A = X - U.dot(np.diag(s).dot(V))
290289
error = linalg.norm(A, ord='fro')
291-
print(error_2 - error)
292290
assert_greater(15, np.abs(error_2 - error))
293291

294292

@@ -357,8 +355,8 @@ def test_cartesian():
357355

358356
def test_logistic_sigmoid():
359357
# Check correctness and robustness of logistic sigmoid implementation
360-
naive_logistic = lambda x: 1 / (1 + np.exp(-x))
361-
naive_log_logistic = lambda x: np.log(naive_logistic(x))
358+
def naive_log_logistic(x):
359+
return np.log(1 / (1 + np.exp(-x)))
362360

363361
x = np.linspace(-2, 2, 50)
364362
assert_array_almost_equal(log_logistic(x), naive_log_logistic(x))

0 commit comments

Comments
 (0)