Skip to content

Commit 96f0a01

Browse files
authored
MAINT Clean deprecation for 1.2: default random_state in randomized_svd (#24661)
1 parent eb5f340 commit 96f0a01

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

sklearn/utils/extmath.py

+2-18
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def randomized_svd(
293293
power_iteration_normalizer="auto",
294294
transpose="auto",
295295
flip_sign=True,
296-
random_state="warn",
296+
random_state=None,
297297
svd_lapack_driver="gesdd",
298298
):
299299
"""Compute a truncated randomized SVD.
@@ -366,10 +366,7 @@ def randomized_svd(
366366
function calls. See :term:`Glossary <random_state>`.
367367
368368
.. versionchanged:: 1.2
369-
The previous behavior (`random_state=0`) is deprecated, and
370-
from v1.2 the default value will be `random_state=None`. Set
371-
the value of `random_state` explicitly to suppress the deprecation
372-
warning.
369+
The default value changed from 0 to None.
373370
374371
svd_lapack_driver : {"gesdd", "gesvd"}, default="gesdd"
375372
Whether to use the more efficient divide-and-conquer approach
@@ -431,19 +428,6 @@ def randomized_svd(
431428
sparse.SparseEfficiencyWarning,
432429
)
433430

434-
if random_state == "warn":
435-
warnings.warn(
436-
"If 'random_state' is not supplied, the current default "
437-
"is to use 0 as a fixed seed. This will change to "
438-
"None in version 1.2 leading to non-deterministic results "
439-
"that better reflect nature of the randomized_svd solver. "
440-
"If you want to silence this warning, set 'random_state' "
441-
"to an integer seed or to None explicitly depending "
442-
"if you want your code to be deterministic or not.",
443-
FutureWarning,
444-
)
445-
random_state = 0
446-
447431
random_state = check_random_state(random_state)
448432
n_random = n_components + n_oversamples
449433
n_samples, n_features = M.shape

0 commit comments

Comments
 (0)