Skip to content

DOC Clarifies docstrings in decomposition #19161

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
Jan 13, 2021
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
14 changes: 7 additions & 7 deletions sklearn/decomposition/_dict_learning.py
Original file line number Diff line number Diff line change
Expand Up @@ -1156,10 +1156,10 @@ class DictionaryLearning(_BaseSparseCoding, BaseEstimator):

fit_algorithm : {'lars', 'cd'}, default='lars'
* `'lars'`: uses the least angle regression method to solve the lasso
problem (`linear_model.lars_path`);
problem (:func:`~sklearn.linear_model.lars_path`);
* `'cd'`: uses the coordinate descent method to compute the
Lasso solution (`linear_model.Lasso`). Lars will be faster if
the estimated components are sparse.
Lasso solution (:class:`~sklearn.linear_model.Lasso`). Lars will be
faster if the estimated components are sparse.

.. versionadded:: 0.17
*cd* coordinate descent method to improve speed.
Expand All @@ -1169,11 +1169,11 @@ class DictionaryLearning(_BaseSparseCoding, BaseEstimator):
Algorithm used to transform the data:

- `'lars'`: uses the least angle regression method
(`linear_model.lars_path`);
(:func:`~sklearn.linear_model.lars_path`);
- `'lasso_lars'`: uses Lars to compute the Lasso solution.
- `'lasso_cd'`: uses the coordinate descent method to compute the
Lasso solution (`linear_model.Lasso`). `'lasso_lars'` will be faster
if the estimated components are sparse.
Lasso solution (:class:`~sklearn.linear_model.Lasso`). `'lasso_lars'`
will be faster if the estimated components are sparse.
- `'omp'`: uses orthogonal matching pursuit to estimate the sparse
solution.
- `'threshold'`: squashes to zero all coefficients less than alpha from
Expand Down Expand Up @@ -1404,7 +1404,7 @@ class MiniBatchDictionaryLearning(_BaseSparseCoding, BaseEstimator):
shuffle : bool, default=True
Whether to shuffle the samples before forming batches.

dict_init : nbarray of shape (n_components, n_features), default=None
dict_init : ndarray of shape (n_components, n_features), default=None
initial value of the dictionary for warm restart scenarios

transform_algorithm : {'lasso_lars', 'lasso_cd', 'lars', 'omp', \
Expand Down
2 changes: 1 addition & 1 deletion sklearn/decomposition/_lda.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class LatentDirichletAllocation(TransformerMixin, BaseEstimator):
Number of documents to use in each EM iteration. Only used in online
learning.

evaluate_every : int, default=0
evaluate_every : int, default=-1
How often to evaluate perplexity. Only used in `fit` method.
set it to 0 or negative number to not evaluate perplexity in
training at all. Evaluating perplexity can help you check convergence
Expand Down
26 changes: 13 additions & 13 deletions sklearn/decomposition/_nmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1138,23 +1138,23 @@ class NMF(TransformerMixin, BaseEstimator):
Default: None.
Valid options:

- None: 'nndsvd' if n_components <= min(n_samples, n_features),
otherwise random.
- `None`: 'nndsvd' if n_components <= min(n_samples, n_features),
otherwise random.

- 'random': non-negative random matrices, scaled with:
sqrt(X.mean() / n_components)
- `'random'`: non-negative random matrices, scaled with:
sqrt(X.mean() / n_components)

- 'nndsvd': Nonnegative Double Singular Value Decomposition (NNDSVD)
initialization (better for sparseness)
- `'nndsvd'`: Nonnegative Double Singular Value Decomposition (NNDSVD)
initialization (better for sparseness)

- 'nndsvda': NNDSVD with zeros filled with the average of X
(better when sparsity is not desired)
- `'nndsvda'`: NNDSVD with zeros filled with the average of X
(better when sparsity is not desired)

- 'nndsvdar': NNDSVD with zeros filled with small random values
(generally faster, less accurate alternative to NNDSVDa
for when sparsity is not desired)
- `'nndsvdar'` NNDSVD with zeros filled with small random values
(generally faster, less accurate alternative to NNDSVDa
for when sparsity is not desired)

- 'custom': use custom matrices W and H
- `'custom'`: use custom matrices W and H

solver : {'cd', 'mu'}, default='cd'
Numerical solver to use:
Expand Down Expand Up @@ -1207,7 +1207,7 @@ class NMF(TransformerMixin, BaseEstimator):
Regularization parameter *l1_ratio* used in the Coordinate Descent
solver.

verbose : bool, default=False
verbose : int, default=0
Whether to be verbose.

shuffle : bool, default=False
Expand Down
2 changes: 1 addition & 1 deletion sklearn/decomposition/_pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class PCA(_BasePCA):

Parameters
----------
n_components : int, float or str, default=None
n_components : int, float or 'mle', default=None
Number of components to keep.
if n_components is not set all components are kept::

Expand Down