66Transform a signal as a sparse combination of Ricker wavelets. This example
77visually compares different sparse coding methods using the
88:class:`sklearn.decomposition.SparseCoder` estimator. The Ricker (also known
9- as mexican hat or the second derivative of a Gaussian) is not a particularly
9+ as Mexican hat or the second derivative of a Gaussian) is not a particularly
1010good kernel to represent piecewise constant signals like this one. It can
1111therefore be seen how much adding different widths of atoms matters and it
1212therefore motivates learning the dictionary to best fit your type of signals.
2323
2424
2525def ricker_function (resolution , center , width ):
26- """Discrete sub-sampled Ricker (mexican hat) wavelet"""
26+ """Discrete sub-sampled Ricker (Mexican hat) wavelet"""
2727 x = np .linspace (0 , resolution - 1 , resolution )
2828 x = ((2 / ((np .sqrt (3 * width ) * np .pi ** 1 / 4 )))
2929 * (1 - ((x - center ) ** 2 / width ** 2 ))
@@ -32,7 +32,7 @@ def ricker_function(resolution, center, width):
3232
3333
3434def ricker_matrix (width , resolution , n_components ):
35- """Dictionary of Ricker (mexican hat) wavelets"""
35+ """Dictionary of Ricker (Mexican hat) wavelets"""
3636 centers = np .linspace (0 , resolution - 1 , n_components )
3737 D = np .empty ((n_components , resolution ))
3838 for i , center in enumerate (centers ):
0 commit comments