Skip to content

Commit

Permalink
Merge pull request scipy#16717 from tupui/seed_docstrings
Browse files Browse the repository at this point in the history
DOC: reformat seed docstrings
  • Loading branch information
rgommers committed Jul 29, 2022
2 parents ef7ef36 + b67df6a commit b423701
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 65 deletions.
4 changes: 1 addition & 3 deletions scipy/_lib/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,7 @@ def check_random_state(seed):
Parameters
----------
seed : {None, int, `numpy.random.Generator`,
`numpy.random.RandomState`}, optional
seed : {None, int, `numpy.random.Generator`, `numpy.random.RandomState`}, optional
If `seed` is None (or `np.random`), the `numpy.random.RandomState`
singleton is used.
If `seed` is an int, a new ``RandomState`` instance is used,
Expand Down
8 changes: 2 additions & 6 deletions scipy/cluster/vq.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,7 @@ def kmeans(obs, k_or_guess, iter=20, thresh=1e-5, check_finite=True,
(crashes, non-termination) if the inputs do contain infinities or NaNs.
Default: True
seed : {None, int, `numpy.random.Generator`,
`numpy.random.RandomState`}, optional
seed : {None, int, `numpy.random.Generator`, `numpy.random.RandomState`}, optional
Seed for initializing the pseudo-random number generator.
If `seed` is None (or `numpy.random`), the `numpy.random.RandomState`
singleton is used.
Expand Down Expand Up @@ -666,9 +664,7 @@ def kmeans2(data, k, iter=10, thresh=1e-5, minit='random',
Disabling may give a performance gain, but may result in problems
(crashes, non-termination) if the inputs do contain infinities or NaNs.
Default: True
seed : {None, int, `numpy.random.Generator`,
`numpy.random.RandomState`}, optional
seed : {None, int, `numpy.random.Generator`, `numpy.random.RandomState`}, optional
Seed for initializing the pseudo-random number generator.
If `seed` is None (or `numpy.random`), the `numpy.random.RandomState`
singleton is used.
Expand Down
8 changes: 2 additions & 6 deletions scipy/linalg/_sketches.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ def cwt_matrix(n_rows, n_columns, seed=None):
Number of rows of S
n_columns : int
Number of columns of S
seed : {None, int, `numpy.random.Generator`,
`numpy.random.RandomState`}, optional
seed : {None, int, `numpy.random.Generator`, `numpy.random.RandomState`}, optional
If `seed` is None (or `np.random`), the `numpy.random.RandomState`
singleton is used.
If `seed` is an int, a new ``RandomState`` instance is used,
Expand Down Expand Up @@ -73,9 +71,7 @@ def clarkson_woodruff_transform(input_matrix, sketch_size, seed=None):
Input matrix, of shape ``(n, d)``.
sketch_size : int
Number of rows for the sketch.
seed : {None, int, `numpy.random.Generator`,
`numpy.random.RandomState`}, optional
seed : {None, int, `numpy.random.Generator`, `numpy.random.RandomState`}, optional
If `seed` is None (or `np.random`), the `numpy.random.RandomState`
singleton is used.
If `seed` is an int, a new ``RandomState`` instance is used,
Expand Down
8 changes: 2 additions & 6 deletions scipy/optimize/_differentialevolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ def differential_evolution(func, bounds, args=(), strategy='best1bin',
denoted by CR. Increasing this value allows a larger number of mutants
to progress into the next generation, but at the risk of population
stability.
seed : {None, int, `numpy.random.Generator`,
`numpy.random.RandomState`}, optional
seed : {None, int, `numpy.random.Generator`, `numpy.random.RandomState`}, optional
If `seed` is None (or `np.random`), the `numpy.random.RandomState`
singleton is used.
If `seed` is an int, a new ``RandomState`` instance is used,
Expand Down Expand Up @@ -471,9 +469,7 @@ class DifferentialEvolutionSolver:
denoted by CR. Increasing this value allows a larger number of mutants
to progress into the next generation, but at the risk of population
stability.
seed : {None, int, `numpy.random.Generator`,
`numpy.random.RandomState`}, optional
seed : {None, int, `numpy.random.Generator`, `numpy.random.RandomState`}, optional
If `seed` is None (or `np.random`), the `numpy.random.RandomState`
singleton is used.
If `seed` is an int, a new ``RandomState`` instance is used,
Expand Down
4 changes: 1 addition & 3 deletions scipy/optimize/_dual_annealing.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,7 @@ def dual_annealing(func, bounds, args=(), maxiter=1000,
algorithm is in the middle of a local search, this number will be
exceeded, the algorithm will stop just after the local search is
done. Default value is 1e7.
seed : {None, int, `numpy.random.Generator`,
`numpy.random.RandomState`}, optional
seed : {None, int, `numpy.random.Generator`, `numpy.random.RandomState`}, optional
If `seed` is None (or `np.random`), the `numpy.random.RandomState`
singleton is used.
If `seed` is an int, a new ``RandomState`` instance is used,
Expand Down
4 changes: 1 addition & 3 deletions scipy/optimize/_optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -986,9 +986,7 @@ def check_grad(func, grad, x0, *args, epsilon=_epsilon,
using `func`. By default it is ``'all'``, in which case, all
the one hot direction vectors are considered to check `grad`.
If `func` is a vector valued function then only ``'all'`` can be used.
seed : {None, int, `numpy.random.Generator`,
`numpy.random.RandomState`}, optional
seed : {None, int, `numpy.random.Generator`, `numpy.random.RandomState`}, optional
If `seed` is None (or `np.random`), the `numpy.random.RandomState`
singleton is used.
If `seed` is an int, a new ``RandomState`` instance is used,
Expand Down
8 changes: 2 additions & 6 deletions scipy/stats/_distn_infrastructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1717,9 +1717,7 @@ class rv_continuous(rv_generic):
subclass has no docstring of its own. Note: `extradoc` exists for
backwards compatibility and will be removed in SciPy 1.11.0, do not
use for new subclasses.
seed : {None, int, `numpy.random.Generator`,
`numpy.random.RandomState`}, optional
seed : {None, int, `numpy.random.Generator`, `numpy.random.RandomState`}, optional
If `seed` is None (or `np.random`), the `numpy.random.RandomState`
singleton is used.
If `seed` is an int, a new ``RandomState`` instance is used,
Expand Down Expand Up @@ -3038,9 +3036,7 @@ class rv_discrete(rv_generic):
subclass has no docstring of its own. Note: `extradoc` exists for
backwards compatibility and will be removed in SciPy 1.11.0, do not
use for new subclasses.
seed : {None, int, `numpy.random.Generator`,
`numpy.random.RandomState`}, optional
seed : {None, int, `numpy.random.Generator`, `numpy.random.RandomState`}, optional
If `seed` is None (or `np.random`), the `numpy.random.RandomState`
singleton is used.
If `seed` is an int, a new ``RandomState`` instance is used,
Expand Down
4 changes: 1 addition & 3 deletions scipy/stats/_kde.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,7 @@ def resample(self, size=None, seed=None):
The number of samples to draw. If not provided, then the size is
the same as the effective number of samples in the underlying
dataset.
seed : {None, int, `numpy.random.Generator`,
`numpy.random.RandomState`}, optional
seed : {None, int, `numpy.random.Generator`, `numpy.random.RandomState`}, optional
If `seed` is None (or `np.random`), the `numpy.random.RandomState`
singleton is used.
If `seed` is an int, a new ``RandomState`` instance is used,
Expand Down
35 changes: 9 additions & 26 deletions scipy/stats/_multivariate.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,9 +722,7 @@ def __init__(self, mean=None, cov=1, allow_singular=False, seed=None,
distribution.
allow_singular : bool, default: ``False``
Whether to allow a singular covariance matrix.
seed : {None, int, `numpy.random.Generator`,
`numpy.random.RandomState`}, optional
seed : {None, int, `numpy.random.Generator`, `numpy.random.RandomState`}, optional
If `seed` is None (or `np.random`), the `numpy.random.RandomState`
singleton is used.
If `seed` is an int, a new ``RandomState`` instance is used,
Expand Down Expand Up @@ -1173,9 +1171,7 @@ class matrix_normal_frozen(multi_rv_frozen):
Parameters
----------
%(_matnorm_doc_default_callparams)s
seed : {None, int, `numpy.random.Generator`,
`numpy.random.RandomState`}, optional
seed : {None, int, `numpy.random.Generator`, `numpy.random.RandomState`}, optional
If `seed` is `None` the `~np.random.RandomState` singleton is used.
If `seed` is an int, a new ``RandomState`` instance is used, seeded
with seed.
Expand Down Expand Up @@ -2276,9 +2272,7 @@ class wishart_frozen(multi_rv_frozen):
Degrees of freedom of the distribution
scale : array_like
Scale matrix of the distribution
seed : {None, int, `numpy.random.Generator`,
`numpy.random.RandomState`}, optional
seed : {None, int, `numpy.random.Generator`, `numpy.random.RandomState`}, optional
If `seed` is None (or `np.random`), the `numpy.random.RandomState`
singleton is used.
If `seed` is an int, a new ``RandomState`` instance is used,
Expand Down Expand Up @@ -3267,9 +3261,7 @@ class multinomial_frozen(multi_rv_frozen):
number of trials
p: array_like
probability of a trial falling into each category; should sum to 1
seed : {None, int, `numpy.random.Generator`,
`numpy.random.RandomState`}, optional
seed : {None, int, `numpy.random.Generator`, `numpy.random.RandomState`}, optional
If `seed` is None (or `np.random`), the `numpy.random.RandomState`
singleton is used.
If `seed` is an int, a new ``RandomState`` instance is used,
Expand Down Expand Up @@ -3489,9 +3481,7 @@ def __init__(self, dim=None, seed=None):
----------
dim : scalar
Dimension of matrices
seed : {None, int, `numpy.random.Generator`,
`numpy.random.RandomState`}, optional
seed : {None, int, `numpy.random.Generator`, `numpy.random.RandomState`}, optional
If `seed` is None (or `np.random`), the `numpy.random.RandomState`
singleton is used.
If `seed` is an int, a new ``RandomState`` instance is used,
Expand Down Expand Up @@ -3647,9 +3637,7 @@ def __init__(self, dim=None, seed=None):
----------
dim : scalar
Dimension of matrices
seed : {None, int, `numpy.random.Generator`,
`numpy.random.RandomState`}, optional
seed : {None, int, `numpy.random.Generator`, `numpy.random.RandomState`}, optional
If `seed` is None (or `np.random`), the `numpy.random.RandomState`
singleton is used.
If `seed` is an int, a new ``RandomState`` instance is used,
Expand Down Expand Up @@ -3688,9 +3676,7 @@ class random_correlation_gen(multi_rv_generic):
----------
eigs : 1d ndarray
Eigenvalues of correlation matrix
seed : {None, int, `numpy.random.Generator`,
`numpy.random.RandomState`}, optional
seed : {None, int, `numpy.random.Generator`, `numpy.random.RandomState`}, optional
If `seed` is None (or `np.random`), the `numpy.random.RandomState`
singleton is used.
If `seed` is an int, a new ``RandomState`` instance is used,
Expand Down Expand Up @@ -3904,9 +3890,7 @@ def __init__(self, eigs, seed=None, tol=1e-13, diag_tol=1e-7):
----------
eigs : 1d ndarray
Eigenvalues of correlation matrix
seed : {None, int, `numpy.random.Generator`,
`numpy.random.RandomState`}, optional
seed : {None, int, `numpy.random.Generator`, `numpy.random.RandomState`}, optional
If `seed` is None (or `np.random`), the `numpy.random.RandomState`
singleton is used.
If `seed` is an int, a new ``RandomState`` instance is used,
Expand Down Expand Up @@ -4069,8 +4053,7 @@ def __init__(self, dim=None, seed=None):
----------
dim : scalar
Dimension of matrices
seed : {None, int, `numpy.random.Generator`,
`numpy.random.RandomState`}, optional
seed : {None, int, `numpy.random.Generator`, `numpy.random.RandomState`}, optional
If `seed` is None (or `np.random`), the `numpy.random.RandomState`
singleton is used.
If `seed` is an int, a new ``RandomState`` instance is used,
Expand Down
4 changes: 1 addition & 3 deletions scipy/stats/_qmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ def check_random_state(seed=None):
Parameters
----------
seed : {None, int, `numpy.random.Generator`,
`numpy.random.RandomState`}, optional
seed : {None, int, `numpy.random.Generator`, `numpy.random.RandomState`}, optional
If `seed` is None the `numpy.random.Generator` singleton is used.
If `seed` is an int, a new ``Generator`` instance is used,
seeded with `seed`.
Expand Down

0 comments on commit b423701

Please sign in to comment.