Skip to content

DOC ensures SparsePCA docstring passes numpydoc validation #20395

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 3 commits into from
Jul 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
1 change: 0 additions & 1 deletion maint_tools/test_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@
"SimpleImputer",
"SkewedChi2Sampler",
"SparseCoder",
"SparsePCA",
"SparseRandomProjection",
"SpectralBiclustering",
"SpectralClustering",
Expand Down
15 changes: 9 additions & 6 deletions sklearn/decomposition/_sparse_pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class SparsePCA(TransformerMixin, BaseEstimator):
Tolerance for the stopping condition.

method : {'lars', 'cd'}, default='lars'
Method to be used for optimization.
lars: uses the least angle regression method to solve the lasso problem
(linear_model.lars_path)
cd: uses the coordinate descent method to compute the
Expand Down Expand Up @@ -93,6 +94,13 @@ class SparsePCA(TransformerMixin, BaseEstimator):

.. versionadded:: 0.24

See Also
--------
PCA : Principal Component Analysis implementation.
MiniBatchSparsePCA : Mini batch variant of `SparsePCA` that is faster but less
accurate.
DictionaryLearning : Generic dictionary learning problem using a sparse code.

Examples
--------
>>> import numpy as np
Expand All @@ -108,12 +116,6 @@ class SparsePCA(TransformerMixin, BaseEstimator):
>>> # most values in the components_ are zero (sparsity)
>>> np.mean(transformer.components_ == 0)
0.9666...

See Also
--------
PCA
MiniBatchSparsePCA
DictionaryLearning
"""

def __init__(
Expand Down Expand Up @@ -153,6 +155,7 @@ def fit(self, X, y=None):
and n_features is the number of features.

y : Ignored
Not used, present here for API consistency by convention.

Returns
-------
Expand Down