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

Skip to content

DOC Docstring improvements to confusion_matrix and splitters #16072

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 8 commits into from
Jan 11, 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
5 changes: 4 additions & 1 deletion sklearn/metrics/_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,10 @@ def confusion_matrix(y_true, y_pred, labels=None, sample_weight=None,
Returns
-------
C : ndarray of shape (n_classes, n_classes)
Confusion matrix.
Confusion matrix whose i-th row and j-th
column entry indicates the number of
samples with true label being i-th class
and prediced label being j-th class.

References
----------
Expand Down
18 changes: 8 additions & 10 deletions sklearn/model_selection/_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,12 @@ class ParameterSampler:
n_iter : integer
Number of parameter settings that are produced.

random_state : int, RandomState instance or None, optional (default=None)
random_state : int, RandomState instance or None, default=None
Pseudo random number generator state used for random uniform sampling
from lists of possible values instead of scipy.stats distributions.
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`.
Pass an int for reproducible output across multiple
function calls.
See :term:`Glossary <random_state>`.

Returns
-------
Expand Down Expand Up @@ -1296,13 +1295,12 @@ class RandomizedSearchCV(BaseSearchCV):
verbose : integer
Controls the verbosity: the higher, the more messages.

random_state : int, RandomState instance or None, optional, default=None
random_state : int, RandomState instance or None, default=None
Pseudo random number generator state used for random uniform sampling
from lists of possible values instead of scipy.stats distributions.
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`.
Pass an int for reproducible output across multiple
function calls.
See :term:`Glossary <random_state>`.

error_score : 'raise' or numeric
Value to assign to the score if an error occurs in estimator fitting.
Expand Down
80 changes: 37 additions & 43 deletions sklearn/model_selection/_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,12 @@ class KFold(_BaseKFold):
Whether to shuffle the data before splitting into batches.
Note that the samples within each split will not be shuffled.

random_state : int, RandomState instance or None, optional, default=None
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`. Only used when ``shuffle`` is True. This should be left
random_state : int, RandomState instance or None, default=None
Only used when ``shuffle`` is True. This should be left
to None if ``shuffle`` is False.
Pass an int for reproducible output across multiple
function calls.
See :term:`Glossary <random_state>`.

Examples
--------
Expand Down Expand Up @@ -587,12 +587,12 @@ class StratifiedKFold(_BaseKFold):
Whether to shuffle each class's samples before splitting into batches.
Note that the samples within each split will not be shuffled.

random_state : int, RandomState instance or None, optional, default=None
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`. Only used when ``shuffle`` is True. This should be left
random_state : int, RandomState instance or None, default=None
Only used when ``shuffle`` is True. This should be left
to None if ``shuffle`` is False.
Pass an int for reproducible output across multiple
function calls.
See :term:`Glossary <random_state>`.

Examples
--------
Expand Down Expand Up @@ -1090,11 +1090,10 @@ class _RepeatedSplits(metaclass=ABCMeta):
n_repeats : int, default=10
Number of times cross-validator needs to be repeated.

random_state : int, RandomState instance or None, optional, default=None
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`.
random_state : int, RandomState instance or None, default=None
Pass an int for reproducible output across multiple
function calls.
See :term:`Glossary <random_state>`.

**cvargs : additional params
Constructor parameters for cv. Must not contain random_state
Expand Down Expand Up @@ -1195,11 +1194,9 @@ class RepeatedKFold(_RepeatedSplits):
n_repeats : int, default=10
Number of times cross-validator needs to be repeated.

random_state : int, RandomState instance or None, optional, default=None
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`.
random_state : int, RandomState instance or None, default=None
Pass an int for reproducible output across multiple
function calls.See :term:`Glossary <random_state>`.

Examples
--------
Expand Down Expand Up @@ -1249,9 +1246,10 @@ class RepeatedStratifiedKFold(_RepeatedSplits):
n_repeats : int, default=10
Number of times cross-validator needs to be repeated.

random_state : None, int or RandomState, default=None
Random state to be used to generate random state for each
repetition.
random_state : int, RandomState instance or None, default=None
Pass an int for reproducible output across multiple
function calls.
See :term:`Glossary <random_state>`.

Examples
--------
Expand Down Expand Up @@ -1389,11 +1387,10 @@ class ShuffleSplit(BaseShuffleSplit):
int, represents the absolute number of train samples. If None,
the value is automatically set to the complement of the test size.

random_state : int, RandomState instance or None, optional (default=None)
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`.
random_state : int, RandomState instance or None, default=None
Pass an int for reproducible output across multiple
function calls.
See :term:`Glossary <random_state>`.

Examples
--------
Expand Down Expand Up @@ -1491,11 +1488,10 @@ class GroupShuffleSplit(ShuffleSplit):
int, represents the absolute number of train groups. If None,
the value is automatically set to the complement of the test size.

random_state : int, RandomState instance or None, optional (default=None)
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`.
random_state : int, RandomState instance or None, default=None
Pass an int for reproducible output across multiple
function calls.
See :term:`Glossary <random_state>`.

Examples
--------
Expand Down Expand Up @@ -1604,11 +1600,10 @@ class StratifiedShuffleSplit(BaseShuffleSplit):
int, represents the absolute number of train samples. If None,
the value is automatically set to the complement of the test size.

random_state : int, RandomState instance or None, optional (default=None)
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`.
random_state : int, RandomState instance or None, default=None
Pass an int for reproducible output across multiple
function calls.
See :term:`Glossary <random_state>`.

Examples
--------
Expand Down Expand Up @@ -2048,11 +2043,10 @@ def train_test_split(*arrays, **options):
int, represents the absolute number of train samples. If None,
the value is automatically set to the complement of the test size.

random_state : int, RandomState instance or None, optional (default=None)
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`.
random_state : int, RandomState instance or None, default=None
Pass an int for reproducible output across multiple
function calls.
See :term:`Glossary <random_state>`.

shuffle : boolean, optional (default=True)
Whether or not to shuffle the data before splitting. If shuffle=False
Expand Down
19 changes: 9 additions & 10 deletions sklearn/model_selection/_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,11 +1003,10 @@ def permutation_test_score(estimator, X, y, groups=None, cv=None,
``-1`` means using all processors. See :term:`Glossary <n_jobs>`
for more details.

random_state : int, RandomState instance or None, optional (default=0)
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`.
random_state : int, RandomState instance or None, default=None
Pass an int for reproducible output across multiple
function calls.
See :term:`Glossary <random_state>`.

verbose : integer, optional
The verbosity level.
Expand Down Expand Up @@ -1173,11 +1172,11 @@ def learning_curve(estimator, X, y, groups=None,
Whether to shuffle training data before taking prefixes of it
based on``train_sizes``.

random_state : int, RandomState instance or None, optional (default=None)
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 ``shuffle`` is True.
random_state : int, RandomState instance or None, default=None
Used when ``shuffle`` is True.
Pass an int for reproducible output across multiple
function calls.
See :term:`Glossary <random_state>`.

error_score : 'raise' or numeric
Value to assign to the score if an error occurs in estimator fitting.
Expand Down