8000 DOC ensures SparsePCA docstring passes numpydoc validation (#20395) · samronsin/scikit-learn@38d5130 · GitHub
[go: up one dir, main page]

Skip to content

Commit 38d5130

Browse files
ijpulidosglemaitre
authored andcommitted
DOC ensures SparsePCA docstring passes numpydoc validation (scikit-learn#20395)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
1 parent 215a212 commit 38d5130

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

maint_tools/test_docstrings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@
142142
"SimpleImputer",
143143
"SkewedChi2Sampler",
144144
"SparseCoder",
145-
"SparsePCA",
146145
"SparseRandomProjection",
147146
"SpectralBiclustering",
148147
"SpectralClustering",

sklearn/decomposition/_sparse_pca.py

Lines changed: 9 additions & 6 deletions
8000
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class SparsePCA(TransformerMixin, BaseEstimator):
4040
Tolerance for the stopping condition.
4141
4242
method : {'lars', 'cd'}, default='lars'
43+
Method to be used for optimization.
4344
lars: uses the least angle regression method to solve the lasso problem
4445
(linear_model.lars_path)
4546
cd: uses the coordinate descent method to compute the
@@ -93,6 +94,13 @@ class SparsePCA(TransformerMixin, BaseEstimator):
9394
9495
.. versionadded:: 0.24
9596
97+
See Also
98+
--------
99+
PCA : Principal Component Analysis implementation.
100+
MiniBatchSparsePCA : Mini batch variant of `SparsePCA` that is faster but less
101+
accurate.
102+
DictionaryLearning : Generic dictionary learning problem using a sparse code.
103+
96104
Examples
97105
--------
98106
>>> import numpy as np
@@ -108,12 +116,6 @@ class SparsePCA(TransformerMixin, BaseEstimator):
108116
>>> # most values in the components_ are zero (sparsity)
109117
>>> np.mean(transformer.components_ == 0)
110118
0.9666...
111-
112-
See Also
113-
--------
114-
PCA
115-
MiniBatchSparsePCA
116-
DictionaryLearning
117119
"""
118120

119121
def __init__(
@@ -153,6 +155,7 @@ def fit(self, X, y=None):
153155
and n_features is the number of features.
154156
155157
y : Ignored
158+
Not used, present here for API consistency by convention.
156159
157160
Returns
158161
-------

0 commit comments

Comments
 (0)
0