8000 DOC Added meaning of default=None for n_components in MiniBatchSparse… · scikit-learn/scikit-learn@d742a58 · GitHub
[go: up one dir, main page]

Skip to content

Commit d742a58

Browse files
authored
DOC Added meaning of default=None for n_components in MiniBatchSparsePCA and MiniBatchDictionaryLearning (#21428)
1 parent 46ceae4 commit d742a58

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

sklearn/decomposition/_dict_learning.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -762,8 +762,9 @@ def dict_learning_online(
762762
X : ndarray of shape (n_samples, n_features)
763763
Data matrix.
764764
765-
n_components : int, default=2
766-
Number of dictionary atoms to extract.
765+
n_components : int or None, default=2
766+
Number of dictionary atoms to extract. If None, then ``n_components``
767+
is set to ``n_features``.
767768
768769
alpha : float, default=1
769770
Sparsity controlling parameter.
@@ -1335,8 +1336,9 @@ class DictionaryLearning(_BaseSparseCoding, BaseEstimator):
13351336
13361337
Parameters
13371338
----------
1338-
n_components : int, default=n_features
1339-
Number of dictionary elements to extract.
1339+
n_components : int, default=None
1340+
Number of dictionary elements to extract. If None, then ``n_components``
1341+
is set to ``n_features``.
13401342
13411343
alpha : float, default=1.0
13421344
Sparsity controlling parameter.

sklearn/decomposition/_sparse_pca.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class SparsePCA(TransformerMixin, BaseEstimator):
2424
----------
2525
n_components : int, default=None
2626
Number of sparse atoms to extract. If None, then ``n_components``
27-
is set to ``n_features_in_``.
27+
is set to ``n_features``.
2828
2929
alpha : float, default=1
3030
Sparsity controlling parameter. Higher values lead to sparser
@@ -249,7 +249,8 @@ class MiniBatchSparsePCA(SparsePCA):
249249
Parameters
250250
----------
251251
n_components : int, default=None
252-
Number of sparse atoms to extract.
252+
Number of sparse atoms to extract. If None, then ``n_components``
253+
is set to ``n_features``.
253254
254255
alpha : int, default=1
255256
Sparsity controlling parameter. Higher values lead to sparser

0 commit comments

Comments
 (0)
0