Skip to content
Snippets Groups Projects
Commit 531b1876 authored by Vlad Niculae's avatar Vlad Niculae
Browse files

Merge branch 'dictionary_learning' of git://github.com/GaelVaroquaux/scikit-learn into sc

Conflicts:
	examples/decomposition/plot_img_denoising.py
parents 200031e2 f0b0cfe9
Branches
Tags
No related merge requests found
...@@ -14,9 +14,9 @@ at the difference between the reconstruction and the original image. If the ...@@ -14,9 +14,9 @@ at the difference between the reconstruction and the original image. If the
reconstruction is perfect this will look like gaussian noise. reconstruction is perfect this will look like gaussian noise.
It can be seen from the plots that the results of :ref:`omp` with two It can be seen from the plots that the results of :ref:`omp` with two
non-zero coefficients is a bit less biased than when keeping only one (the non-zero coefficients is a bit less biased than when keeping only one
edges look less prominent). However, it is farther from the ground truth in (the edges look less prominent). It is in addition closer from the ground
Frobenius norm. truth in Frobenius norm.
The result of :ref:`least_angle_regression` is much more strongly biased: the The result of :ref:`least_angle_regression` is much more strongly biased: the
difference is reminiscent of the local intensity value of the original image. difference is reminiscent of the local intensity value of the original image.
...@@ -46,8 +46,7 @@ lena = sp.lena() / 256.0 ...@@ -46,8 +46,7 @@ lena = sp.lena() / 256.0
# downsample for higher speed # downsample for higher speed
lena = lena[::2, ::2] + lena[1::2, ::2] + lena[::2, 1::2] + lena[1::2, 1::2] lena = lena[::2, ::2] + lena[1::2, ::2] + lena[::2, 1::2] + lena[1::2, 1::2]
lena = lena[::2, ::2] + lena[1::2, ::2] + lena[::2, 1::2] + lena[1::2, 1::2] lena /= 4.0
lena /= 16.0
height, width = lena.shape height, width = lena.shape
# Distort the right half of the image # Distort the right half of the image
...@@ -123,15 +122,13 @@ data -= intercept ...@@ -123,15 +122,13 @@ data -= intercept
print 'done in %.2fs.' % (time() - t0) print 'done in %.2fs.' % (time() - t0)
transform_algorithms = [ transform_algorithms = [
('Orthogonal Matching Pursuit\n1 atom', ('Orthogonal Matching Pursuit\n1 atom', 'omp',
'omp', {'transform_n_nonzero_coefs': 1}), {'transform_n_nonzero_coefs': 1}),
('Orthogonal Matching Pursuit\n2 atoms', ('Orthogonal Matching Pursuit\n2 atoms', 'omp',
'omp', {'transform_n_nonzero_coefs': 2}), {'transform_n_nonzero_coefs': 2}),
('Least-angle regression\n5 atoms', ('Least-angle regression\n5 atoms', 'lars',
'lars', {'transform_n_nonzero_coefs': 5}), {'transform_n_nonzero_coefs': 5}),
('Thresholding\n alpha=0.1', 'threshold', ('Thresholding\n alpha=0.1', 'threshold', {'transform_alpha': .1})]
{'transform_alpha': .1}),
]
reconstructions = {} reconstructions = {}
for title, transform_algorithm, kwargs in transform_algorithms: for title, transform_algorithm, kwargs in transform_algorithms:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment