From aac28b7bc389b4801e7ff2ac21779c912e7193d1 Mon Sep 17 00:00:00 2001 From: maikia Date: Fri, 2 Sep 2022 10:19:01 +0200 Subject: [PATCH 1/2] correct docstring fro dict_learningn --- sklearn/decomposition/_dict_learning.py | 14 +++++++------- sklearn/tests/test_docstrings.py | 1 - 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/sklearn/decomposition/_dict_learning.py b/sklearn/decomposition/_dict_learning.py index 32f0e76a195dd..5e1f55bf691ec 100644 --- a/sklearn/decomposition/_dict_learning.py +++ b/sklearn/decomposition/_dict_learning.py @@ -511,7 +511,7 @@ def dict_learning( positive_code=False, method_max_iter=1000, ): - """Solves a dictionary learning matrix factorization problem. + """Solve a dictionary learning matrix factorization problem. Finds the best dictionary and the corresponding sparse code for approximating the data matrix X by solving:: @@ -567,7 +567,7 @@ def dict_learning( if `code_init` and `dict_init` are not None. callback : callable, default=None - Callable that gets invoked every five iterations + Callable that gets invoked every five iterations. verbose : bool, default=False To control the verbosity of the procedure. @@ -612,11 +612,11 @@ def dict_learning( See Also -------- - dict_learning_online - DictionaryLearning - MiniBatchDictionaryLearning - SparsePCA - MiniBatchSparsePCA + dict_learning_online : Solve a dictionary learning matrix factorization problem online. + DictionaryLearning : Find a dictionary that sparsely encodes data. + MiniBatchDictionaryLearning : A faster, less accurate version of the dictionary learning algorithm. + SparsePCA : Sparse Principal Components Analysis. + MiniBatchSparsePCA : Mini-batch Sparse Principal Components Analysis. """ if method not in ("lars", "cd"): raise ValueError("Coding method %r not supported as a fit algorithm." % method) diff --git a/sklearn/tests/test_docstrings.py b/sklearn/tests/test_docstrings.py index afe65140b72ce..617969b2e3834 100644 --- a/sklearn/tests/test_docstrings.py +++ b/sklearn/tests/test_docstrings.py @@ -12,7 +12,6 @@ numpydoc_validation = pytest.importorskip("numpydoc.validate") FUNCTION_DOCSTRING_IGNORE_LIST = [ - "sklearn.decomposition._dict_learning.dict_learning", "sklearn.externals._packaging.version.parse", "sklearn.inspection._plot.partial_dependence.plot_partial_dependence", "sklearn.linear_model._least_angle.lars_path_gram", From 70aba7800a8804b338cd3a65f6cc34d96c704003 Mon Sep 17 00:00:00 2001 From: maikia Date: Fri, 2 Sep 2022 12:48:42 +0200 Subject: [PATCH 2/2] shorten the lines --- sklearn/decomposition/_dict_learning.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sklearn/decomposition/_dict_learning.py b/sklearn/decomposition/_dict_learning.py index 5e1f55bf691ec..4620011a01695 100644 --- a/sklearn/decomposition/_dict_learning.py +++ b/sklearn/decomposition/_dict_learning.py @@ -612,9 +612,11 @@ def dict_learning( See Also -------- - dict_learning_online : Solve a dictionary learning matrix factorization problem online. + dict_learning_online : Solve a dictionary learning matrix factorization + problem online. DictionaryLearning : Find a dictionary that sparsely encodes data. - MiniBatchDictionaryLearning : A faster, less accurate version of the dictionary learning algorithm. + MiniBatchDictionaryLearning : A faster, less accurate version + of the dictionary learning algorithm. SparsePCA : Sparse Principal Components Analysis. MiniBatchSparsePCA : Mini-batch Sparse Principal Components Analysis. """