Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
295c131
dict learning onlinefunc uses class instead of the opposite
jeremiedbb Dec 7, 2020
8d383a8
deprecate a lot of stuff
jeremiedbb Dec 9, 2020
4db4917
lint
jeremiedbb Dec 9, 2020
8ec1069
lint
jeremiedbb Dec 9, 2020
c3b935d
lint again
jeremiedbb Dec 9, 2020
e856bc3
plz lint be nice
jeremiedbb Dec 9, 2020
c0e1fc3
add tests
jeremiedbb Dec 10, 2020
b2efe08
fix doc example
jeremiedbb Dec 10, 2020
48f7756
lint
jeremiedbb Dec 10, 2020
02dc2d7
fix broken tests
jeremiedbb Dec 10, 2020
27e457e
get rid of iter_offset
jeremiedbb Dec 10, 2020
fb91c8d
better document test
jeremiedbb Dec 10, 2020
bd3bb2d
cln
jeremiedbb Dec 11, 2020
98004b6
Merge branch 'master' into dict-learning-func-call-class
jeremiedbb Dec 16, 2020
879e8b9
add max_iter; add n_batches_seen_
jeremiedbb Dec 16, 2020
a34999c
lint
jeremiedbb Dec 16, 2020
c40c5eb
lint
jeremiedbb Dec 16, 2020
31ff13d
wip
jeremiedbb Dec 22, 2020
5ec3e53
Merge branch 'master' into dict-learning-func-call-class
jeremiedbb Dec 22, 2020
f5ac665
wip
jeremiedbb Jan 17, 2021
ce065ba
several fixes to dict update in dict learning
jeremiedbb Jan 17, 2021
d78859b
fix docstrings
jeremiedbb Jan 18, 2021
66553aa
avoid noise with 0 std
jeremiedbb Jan 18, 2021
2885c21
add test for dict update
jeremiedbb Jan 19, 2021
bd30598
better test
jeremiedbb Jan 19, 2021
fcf260f
adress review comments
jeremiedbb Jan 21, 2021
e67109c
what's new
jeremiedbb Jan 21, 2021
d963043
only print at the end of the update
jeremiedbb Jan 22, 2021
440d6fb
fix verbose behavior
jeremiedbb Jan 22, 2021
f51d6fe
Merge branch 'master' into fix-dict-update
jeremiedbb Jan 22, 2021
ccaffa7
Merge branch 'master' into dict-learning-func-call-class
jeremiedbb Jan 22, 2021
9833286
Merge branch 'fix-dict-update' into dict-learning-func-call-class
jeremiedbb Jan 22, 2021
0f537ea
wip
jeremiedbb Jan 25, 2021
c1661c9
add stopping criterion
jeremiedbb Jan 26, 2021
4e3f782
Merge branch 'master' into dict-learning-func-call-class
jeremiedbb Jan 26, 2021
651b98e
cln
jeremiedbb Jan 27, 2021
52cf4ed
cln
jeremiedbb Jan 28, 2021
c666513
allow max_iter = 0
jeremiedbb Jan 28, 2021
6b7218d
make n_iter_ count number of started epochs
jeremiedbb Jan 28, 2021
4fa6289
set max_iter in common tests (cause n_iter deprecated)
jeremiedbb Jan 28, 2021
37b9fd8
Merge remote-tracking branch 'upstream/main' into dict-learning-func-…
jeremiedbb Feb 12, 2021
f752126
don't sort list with 1 elem.
jeremiedbb Feb 15, 2021
7c7295f
Merge branch 'master' into dict-learning-func-call-class
jeremiedbb Apr 15, 2021
5cadf2a
cln
jeremiedbb Apr 15, 2021
e3ac61d
attr name
jeremiedbb Apr 15, 2021
414d79d
fix docstring params
jeremiedbb Apr 15, 2021
3281b34
Merge branch 'master' into dict-learning-func-call-class
jeremiedbb May 10, 2021
4678b61
Merge branch 'main' into dict-learning-func-call-class
ogrisel Jun 7, 2021
b21d814
Merge branch 'master' into dict-learning-func-call-class
jeremiedbb Oct 19, 2021
d392b54
cln
jeremiedbb Oct 19, 2021
1673f21
black
jeremiedbb Oct 19, 2021
6dc08da
Merge branch 'dict-learning-func-call-class' of github.com:jeremiedbb…
jeremiedbb Oct 19, 2021
14a86a5
cln depr versions
jeremiedbb Oct 19, 2021
7910faf
cln
jeremiedbb Oct 19, 2021
6aceffe
cln
jeremiedbb Oct 19, 2021
0acad3b
black
jeremiedbb Oct 19, 2021
06b9e64
wip
jeremiedbb Oct 19, 2021
0916775
mypy
jeremiedbb Oct 20, 2021
19f51ca
cln
jeremiedbb Oct 20, 2021
578aba9
what's new entry
jeremiedbb Oct 20, 2021
921ab43
wip
jeremiedbb Oct 20, 2021
572dfdf
wip
jeremiedbb Oct 20, 2021
1de10b1
wip
jeremiedbb Oct 20, 2021
5e448ec
wip
jeremiedbb Oct 20, 2021
0a88e1b
wip
jeremiedbb Oct 20, 2021
9de2059
fix test docstring params
jeremiedbb Oct 20, 2021
7acc77d
fix warning example
jeremiedbb Oct 20, 2021
46caecc
numpydoc
jeremiedbb Oct 20, 2021
0aed0e9
fix sphinx warnings ?
jeremiedbb Oct 20, 2021
b8a1750
fix sphinx warnings
jeremiedbb Oct 21, 2021
3bbba59
iter
jeremiedbb Oct 21, 2021
8dc83dd
Merge branch 'master' into dict-learning-func-call-class
jeremiedbb Oct 21, 2021
a4038d8
debug
jeremiedbb Oct 21, 2021
e6a6b46
iter
jeremiedbb Oct 21, 2021
01aa417
Merge branch 'master' into dict-learning-func-call-class
jeremiedbb Oct 27, 2021
3aebd81
improve coverage
jeremiedbb Oct 27, 2021
12ac43f
Merge branch 'master' into dict-learning-func-call-class
jeremiedbb Oct 27, 2021
320e3cc
black
jeremiedbb Oct 27, 2021
b14f721
iter
jeremiedbb Oct 27, 2021
2003a72
Merge branch 'master' into dict-learning-func-call-class
jeremiedbb Oct 27, 2021
069446f
improve coverage
jeremiedbb Oct 27, 2021
ed814f7
black
jeremiedbb Oct 27, 2021
6369341
Merge branch 'master' into dict-learning-func-call-class
jeremiedbb Nov 2, 2021
d1dc069
trigger ci
jeremiedbb Nov 3, 2021
b53294b
address comments
jeremiedbb Nov 3, 2021
afcb16c
improve coverage
jeremiedbb Nov 3, 2021
747ffdc
cln
jeremiedbb Nov 3, 2021
86d5d3e
cln + address comments
jeremiedbb Dec 6, 2021
75520cd
Merge branch 'master' into dict-learning-func-call-class
jeremiedbb Dec 6, 2021
76817c9
cln
jeremiedbb Dec 6, 2021
f573af1
cln doc
jeremiedbb Dec 6, 2021
28b7ecf
Merge remote-tracking branch 'upstream/main' into dict-learning-func-…
jeremiedbb Dec 6, 2021
996ed7b
Merge branch 'master' into dict-learning-func-call-class
jeremiedbb Feb 9, 2022
8e41bbd
cln merge
jeremiedbb Feb 9, 2022
54d39dd
Merge branch 'master' into dict-learning-func-call-class
jeremiedbb Feb 9, 2022
fc99f6d
fix preserve dtype float32
jeremiedbb Feb 9, 2022
5b70b0d
don't change ordering of rng consuming
jeremiedbb Feb 9, 2022
bd82169
Merge branch 'master' into dict-learning-func-call-class
jeremiedbb Feb 11, 2022
35a58f7
set batch_size
jeremiedbb Feb 11, 2022
5945350
Tweak denoising example
ogrisel Feb 15, 2022
9f23d07
Back to 50 components to get faster running example
ogrisel Feb 15, 2022
fadc52b
Merge branch 'master' into dict-learning-func-call-class
jeremiedbb Feb 16, 2022
837b9d4
black
jeremiedbb Feb 16, 2022
bbdce1d
Merge branch 'master' into dict-learning-func-call-class
jeremiedbb Mar 4, 2022
9979d11
review comments
jeremiedbb Mar 4, 2022
4dcf09b
Merge branch 'main' into dict-learning-func-call-class
ogrisel Mar 24, 2022
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
18 changes: 18 additions & 0 deletions doc/whats_new/v1.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,24 @@ Changelog
get accurate results when the number of features is large.
:pr:`21109` by :user:`Smile <x-shadow-man>`.

- |Enhancement| The :class:`decomposition.MiniBatchDictionaryLearning` and
:func:`decomposition.dict_learning_online` have been refactored and now have a
stopping criterion based on a small change of the dictionary or objective function,
controlled by the new `max_iter`, `tol` and `max_no_improvement` parameters. In
addition, some of their parameters and attributes are deprecated.

- the `n_iter` parameter of both is deprecated. Use `max_iter` instead.
- the `iter_offset`, `return_inner_stats`, `inner_stats` and `return_n_iter`
parameters of :func:`decomposition.dict_learning_online` serve internal purpose
and are deprecated.
- the `inner_stats_`, `iter_offset_` and `random_state_` attributes of
:class:`decomposition.MiniBatchDictionaryLearning` serve internal purpose and are
deprecated.
- the default value of the `batch_size` parameter of both will change from 3 to 256
in version 1.3.

:pr:`18975` by :user:`Jérémie du Boisberranger <jeremiedbb>`.

- |Enhancement| :func:`decomposition.dict_learning`, :func:`decomposition.dict_learning_online`
and :func:`decomposition.sparse_encode` preserve dtype for `numpy.float32`.
:class:`decomposition.DictionaryLearning`, :class:`decompsition.MiniBatchDictionaryLearning`
Expand Down
13 changes: 10 additions & 3 deletions examples/decomposition/plot_image_denoising.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def show_with_diff(image, reference, title):
data = data.reshape(data.shape[0], -1)
data -= np.mean(data, axis=0)
data /= np.std(data, axis=0)
print("done in %.2fs." % (time() - t0))
print(f"{data.shape[0]} patches extracted in %.2fs." % (time() - t0))


# %%
Expand All @@ -116,10 +116,17 @@ def show_with_diff(image, reference, title):

print("Learning the dictionary...")
t0 = time()
dico = MiniBatchDictionaryLearning(n_components=50, alpha=1, n_iter=250)
dico = MiniBatchDictionaryLearning(
# increase to 300 for higher quality results at the cost of slower
# training times.
n_components=50,
batch_size=200,
alpha=1.0,
max_iter=10,
)
V = dico.fit(data).components_
dt = time() - t0
print("done in %.2fs." % dt)
print(f"{dico.n_iter_} iterations / {dico.n_steps_} steps in {dt:.2f}.")

plt.figure(figsize=(4.2, 4))
for i, comp in enumerate(V[:100]):
Expand Down
Loading