Reading time: 5 min

26 /2/2019

Selecting the best wavelet for decomposition using Shannon Entropy

Wavelet transform is a pretty awesome signal processing technique to extract time frequency data, however choosing the optimal wavelet to use and best decomposition level often leaves us scratching our heads. Our main intuition in selecting good parameters for wavelet transform often comes down to experience and prior information we have, such as interested frequency bands or similarity of signal shapes with wavelets. However, there are numerous journal papers outlining different approaches to extract these parameters.

In this post, I will focus on best wavelet selection using Shannon Entropy outlined in a journal paper by Yang & Wang (2015).

The general procedure is as follows:

  1. Choose a range of wavelets to compare (e.g db1-8, bior, dmey, sym),
  2. Decompose signal into J levels using either wavelet transform or wavelet packer decomposition,
  3. For approximation and detail components, calculate the relative energy
  4. Determine the Shannon entropy using this equation

    where p_k = E^{i}_{J}/E_T (Relative Energy/Total Energy), N is the number of decomposed details.
  5. Calculate the Shannon entropy to total wavelet energy ratio
  6. Pick the wavelet with the highest ratio.

Let’s go through the procedure step by step in Matlab.

1. Choose a range of wavelets to compare

ratio = {}; 
wav_type ={'db1','db2','db3','db4','db5','db6','db7','db8','db9','db10',... 
'coif1','coif2','coif3','coif4','coif5',... 
'sym1','sym2','sym3','sym4','sym5','sym6','sym7','sym8',... 
'bior1.3','bior1.5','bior2.2','bior2.4','bior2.6','bior2.8',... 
'bior3.1','bior3.3','bior3.5','bior3.7','bior3.9','bior4.4','bior6.8',...
'dmey'};

2. Decompose signal into J levels using wavelet packet decomposition

signal = signal1.mat; %You will set your own signal data file level = 5; 
%Choose the appropriate decomposition level based on your data
nodeind = 0:2^level-2^(level-1)-1; %node index for wavelet tree for 
k=1:size(wavelet,2) 
wpt = wpdec(signal,level, wavelet{k}, 'shannon');

3. Calculate relative energy for each detail component

E = [];
pk = [];
  for i = 1:length(nodeind) 
    wp_detail = wpcoef(wpt, [level, nodeind(i)]); 
    E(i) = sum(abs(wp_detail).^2);
  end    
Et = sum(E);

4. Determine shannon entropy for this level using relative energy

pk = E./Et;
shannon_entropy =  -sum(pk*log(pk)');

5. Calculate Shannon Entropy to Total Energy Ratio

ratio(k,1) = Et/shannon_entropy;
ratio(k,2) = wavelet{k}; 

6.  Pick wavelet with highest ratio

%Sort from largest to smallest
temp_sort = sortrows(ratio,1);
best_wavelet = temp{end,2};

References:
Yang, Q., Wang, J., 2015, Multi-level Wavelet Shannon Entropy-Based Method for Single-Sensor Fault Location, Entropy, Vol.17, pp.7101-7117

Hello.

Submit a form to get to touch