From 9c85a40afd37acba52a0528335bff278efbd38db Mon Sep 17 00:00:00 2001 From: Maren Westermann Date: Mon, 2 May 2022 17:43:53 +0200 Subject: [PATCH 1/3] specify the meaning of dict_init=None --- sklearn/decomposition/_dict_learning.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sklearn/decomposition/_dict_learning.py b/sklearn/decomposition/_dict_learning.py index 1cdb69499ea21..5095d35881ff6 100644 --- a/sklearn/decomposition/_dict_learning.py +++ b/sklearn/decomposition/_dict_learning.py @@ -808,7 +808,12 @@ def dict_learning_online( Whether to also return the code U or just the dictionary `V`. dict_init : ndarray of shape (n_components, n_features), default=None - Initial value for the dictionary for warm restart scenarios. + Initial values for the dictionary for warm restart scenarios. + If `None`, the initial values for the dictionary are created + using :func:`randomized_svd` as:: + + _, S, dictionary = randomized_svc(X, n_components, random_state) + dictionary = S[:, np.newaxis] * dictionary callback : callable, default=None A callable that gets invoked at the end of each iteration. From a6bd28d5269859d420afc0a58f925a8a732aafeb Mon Sep 17 00:00:00 2001 From: Maren Westermann Date: Wed, 4 May 2022 17:48:46 +0200 Subject: [PATCH 2/3] address comments --- sklearn/decomposition/_dict_learning.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sklearn/decomposition/_dict_learning.py b/sklearn/decomposition/_dict_learning.py index 5095d35881ff6..ea88a91e04657 100644 --- a/sklearn/decomposition/_dict_learning.py +++ b/sklearn/decomposition/_dict_learning.py @@ -810,10 +810,7 @@ def dict_learning_online( dict_init : ndarray of shape (n_components, n_features), default=None Initial values for the dictionary for warm restart scenarios. If `None`, the initial values for the dictionary are created - using :func:`randomized_svd` as:: - - _, S, dictionary = randomized_svc(X, n_components, random_state) - dictionary = S[:, np.newaxis] * dictionary + using :func:`~sklearn.utils.randomized_svd`. callback : callable, default=None A callable that gets invoked at the end of each iteration. From cb3651509eb096982b68df81e261b5a522e368f7 Mon Sep 17 00:00:00 2001 From: Maren Westermann Date: Wed, 4 May 2022 18:15:03 +0200 Subject: [PATCH 3/3] update description --- sklearn/decomposition/_dict_learning.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sklearn/decomposition/_dict_learning.py b/sklearn/decomposition/_dict_learning.py index ea88a91e04657..ad3db76bfd4b5 100644 --- a/sklearn/decomposition/_dict_learning.py +++ b/sklearn/decomposition/_dict_learning.py @@ -810,7 +810,7 @@ def dict_learning_online( dict_init : ndarray of shape (n_components, n_features), default=None Initial values for the dictionary for warm restart scenarios. If `None`, the initial values for the dictionary are created - using :func:`~sklearn.utils.randomized_svd`. + with an SVD decomposition of the data via :func:`~sklearn.utils.randomized_svd`. callback : callable, default=None A callable that gets invoked at the end of each iteration.