Skip to content

[DOC] Update random_state descriptions for mutual_info, unsupervised, .… (4) #16320

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 5 commits into from
Feb 7, 2020
Merged
Show file tree
Hide file tree
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
30 changes: 12 additions & 18 deletions sklearn/feature_selection/_mutual_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,10 @@ def _estimate_mi(X, y, discrete_features='auto', discrete_target=False,
data will be overwritten.

random_state : int, RandomState instance or None, optional, default None
The seed of the pseudo random number generator for adding small noise
to continuous variables in order to remove repeated values. If int,
random_state is the seed used by the random number generator; If
RandomState instance, random_state is the random number generator; If
None, the random number generator is the RandomState instance used by
`np.random`.
Determines random number generation for adding small noise to
continuous variables in order to remove repeated values.
Pass an int for reproducible results across multiple function calls.
See :term:`Glossary <random_state>`.

Returns
-------
Expand Down Expand Up @@ -333,12 +331,10 @@ def mutual_info_regression(X, y, discrete_features='auto', n_neighbors=3,
data will be overwritten.

random_state : int, RandomState instance or None, optional, default None
The seed of the pseudo random number generator for adding small noise
to continuous variables in order to remove repeated values.
If int, random_state is the seed used by the random number generator;
If RandomState instance, random_state is the random number generator;
If None, the random number generator is the RandomState instance used
by `np.random`.
Determines random number generation for adding small noise to
continuous variables in order to remove repeated values.
Pass an int for reproducible results across multiple function calls.
See :term:`Glossary <random_state>`.

Returns
-------
Expand Down Expand Up @@ -412,12 +408,10 @@ def mutual_info_classif(X, y, discrete_features='auto', n_neighbors=3,
data will be overwritten.

random_state : int, RandomState instance or None, optional, default None
The seed of the pseudo random number generator for adding small noise
to continuous variables in order to remove repeated values. If int,
random_state is the seed used by the random number generator; If
RandomState instance, random_state is the random number generator; If
None, the random number generator is the RandomState instance used by
`np.random`.
Determines random number generation for adding small noise to
continuous variables in order to remove repeated values.
Pass an int for reproducible results across multiple function calls.
See :term:`Glossary <random_state>`.

Returns
-------
Expand Down
9 changes: 4 additions & 5 deletions sklearn/metrics/cluster/_unsupervised.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,10 @@ def silhouette_score(X, labels, metric='euclidean', sample_size=None,
If ``sample_size is None``, no sampling is used.

random_state : int, RandomState instance or None, optional (default=None)
The generator used to randomly select a subset of samples. If int,
random_state is the seed used by the random number generator; If
RandomState instance, random_state is the random number generator; If
None, the random number generator is the RandomState instance used by
`np.random`. Used when ``sample_size is not None``.
Determines random number generation for selecting a subset of samples.
Used when ``sample_size is not None``.
Pass an int for reproducible results across multiple function calls.
See :term:`Glossary <random_state>`.

**kwds : optional keyword parameters
Any further parameters are passed directly to the distance function.
Expand Down
18 changes: 8 additions & 10 deletions sklearn/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,11 +476,10 @@ def resample(*arrays, **options):
arrays.

random_state : int, RandomState instance or None, optional (default=None)
The seed of the pseudo random number generator to use when shuffling
the data. If int, random_state is the seed used by the random number
generator; If RandomState instance, random_state is the random number
generator; If None, the random number generator is the RandomState
instance used by `np.random`.
Determines random number generation for shuffling
the data.
Pass an int for reproducible results across multiple function calls.
See :term:`Glossary <random_state>`.

stratify : array-like or None (default=None)
If not None, data is split in a stratified fashion, using this as
Expand Down Expand Up @@ -621,11 +620,10 @@ def shuffle(*arrays, **options):
Other Parameters
----------------
random_state : int, RandomState instance or None, optional (default=None)
The seed of the pseudo random number generator to use when shuffling
the data. If int, random_state is the seed used by the random number
generator; If RandomState instance, random_state is the random number
generator; If None, the random number generator is the RandomState
instance used by `np.random`.
Determines random number generation for shuffling
the data.
Pass an int for reproducible results across multiple function calls.
See :term:`Glossary <random_state>`.

n_samples : int, None by default
Number of samples to generate. If left to None this is
Expand Down
7 changes: 3 additions & 4 deletions sklearn/utils/_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,10 +519,9 @@ def set_random_state(estimator, random_state=0):
estimator : object
The estimator
random_state : int, RandomState instance or None, optional, default=0
Pseudo random number generator state. If int, random_state is the seed
used by the random number generator; If RandomState instance,
random_state is the random number generator; If None, the random number
generator is the RandomState instance used by `np.random`.
Pseudo random number generator state.
Pass an int for reproducible results across multiple function calls.
See :term:`Glossary <random_state>`.
"""
if "random_state" in estimator.get_params():
estimator.set_params(random_state=random_state)
Expand Down