# What is Wavelet and How We Use It for Data Science

What is Wavelet and How We Use It for Data ScienceMuhammad RyanBlockedUnblockFollowFollowingMay 31source: https://ak6.

picdn.

net/shutterstock/videos/28682146/thumb/1.

jpgHello, this is my second post for the signal processing topic.

For now, I’m interested in learning more about signal processing to understand a certain paper.

And to be honest for me, this wavelet thing is harder to understand than Fourier Transform.

It will be faster for me to understand this if I learn this topic with the right step by step of the learning process.

So, here the right step by step in my opinion.

The Idea of WaveletsSo first we need to understand why we need wavelet.

Wavelets come as a solution to the lack of Fourier Transform.

That’s why it’s the best if you try to understand Fourier Transform first before trying to understand wavelets.

But the summary, Fourier Transform is the dot product between real signal and various frequency of sine wave.

source: https://towardsdatascience.

com/insight-to-the-fourier-transform-and-the-simple-implementation-of-it-eee293317efdAnd from this Fourier Transformation, we get a frequency spectrum of the real signal.

We get a stats of frequency but we don't know when that “frequency” happen, we lost the time resolution of the real signal.

To get both frequency and time resolution we can be dividing the original signal into several parts and apply Fourier Transform to each part.

That technique is called Short-Time Fourier Transform.

But this approach raises new problems.

When You apply Short-Time FFT in the partial signal, the Frequency it can catch is just n/2 where n is the length of the partial signal assuming the duration of the partial signal is 1 second.

The minimum frequency we can catch with such a window, 1 HzSo, you cant catch the information about the signal that has a frequency below 1 Hz (assuming the total duration of the signal is more than 1 second but keep in mind when you using some module in python i.

e numpy to do an FFT, it always assuming the duration of your signal is 1 second whatever the duration of your original signal).

We can't catch a wave with a frequency below 1 Hz (in the picture, a 0.

5 Hz wave)To catch such a wave, we need a bigger windowSummary, we need a bigger time window to catch low frequency and smaller window for higher frequency and That is the Idea of Wavelets.

The General Form of Wavelet FormulaThe basic formula of wavelets isActually, this is similar to the formula of the Fourier Transform.

You can think of the integral as a sigma.

Where x is the real signal, ψ is an arbitrary mother wavelet, a is the scale and b is the translation (X is the processed signal of course).

The scale is the same as the size of the window.

Here the illustrations using Morlet Wavelet.

Illustration of how the mother wavelet expand when the scale gets bigger and biggerWhere is “the window”?.Non zero magnitudes of the mother wavelet are “the window” that we are looking for.

Any number that multiplied by zero equal zero so the real signal outside “the window” will be canceled out.

The scale is inversely proportional to the frequency of the mother wavelet (the window).

Remember, the target of the bigger window is a lower frequency.

This is similar to the Fourier Transform because we do a dot product between the real signal and some wave (an arbitrary mother wavelet).

The translation is how far we “slide” the window from the starting point.

Illustration of how the mother wavelet slide when the translation value increaseSo instead of the formula above, we can rewrite the formula asAnyway, the equation of Morlet Wavelet isOr we can rewrite that equation asAnother new term here is arbitrary mother wavelet?.Wait, what?.Arbitrary?.Yes, wavelet has many kinds of mother wavelet and you can define a new one (with several requirements that need to satisfy of course)!.This is the big difference between Fourier Transform and Wavelet Transform, Fourier Transform just has 1 kind of transformation but Wavelet Transform can have many kinds of transformation (the possibilities of the kind of transformation are infinite).

Classes of Wavelet TransformIn general, based on how wavelet transforms treat scale and translation, Types of Wavelet Transform is divided into 2 classes:Continuous Wavelet Transform (CWT)CWT is a Wavelet Transform where we can set the scale and translation arbitrary.

Some commonly used mother wavelets those belong to CWT are:Morlet WaveletMeyer WaveletMexican Hat WaveletCWT often used to generate a scaleogram.

Discrete Wavelet Transform (DWT)DWT is a kind of wavelets that restrict the value of scale and translation.

The restriction is like the scale is increasing in the power of 2 (a = 1, 2, 4, 8,…) and the translation is the integer (b = 1, 2, 3, 4, …).

The kind of mother wavelet of DWT is different from the CWT.

The mother wavelets commonly used on DWT is as follows.

Haar WaveletDaubechies WaveletDaubechies wavelet has a unique scaling restriction.

It has a scaling function called Father Wavelet to determine the right scaling.

DWT usually used to denoise the real signal.

We can use DWT to decompose the real signal, remove the noise part and recomposed it.

How can we know the noise part?.Often in the measurement (wind measurement using Anemometer, earthquake measurement using Seismograph), The noise is a rapid change in the measurement.

Rapid change means high frequency and that’s how it works.

We can use DWT to do a compression of data in the computer like image.

How does it work?.For example for the image, it nearly the same with denoising case.

We get rid of the part of the image with a rapid change of color either in the respect of x-axis or y-axis.

And That’s the explanation of wavelet and it’s application.

Every mother wavelets have its own application.

You don’t need to learn all kind of mother wavelet.

Just use and learn what you need, be pragmatist!references:https://www.

mathworks.

com/help/wavelet/ref/morlet.

html accessed on 19 May 2019https://en.

wikipedia.

org/wiki/Wavelet accessed on 19 May 2019https://en.

wikipedia.

org/wiki/Scaleogram accessed on 19 May 2019https://en.

wikipedia.

org/wiki/Haar_wavelet accessed on 31 May 2019.. More details