File Exchange

## Fuzzy Entropy and Mutual Information

version 1.3 (3.88 KB) by

An implementation of the theory of fuzzy entropy and fuzzy mutual information.

Updated

Nowadays there are heaps of articles on the theory of fuzzy entropy and fuzzy mutual information. However, there is a clear significant lack for a Matlab implementation of these concepts. Based on numerous requests from students and researchers, I have prepared this code to simplify such concepts and give a tool that you can try directly. Of course, you may find heaps of different methods by which you may enhance the functionality of the code, so please feel free to inform me and the rest of any such updates overhere. Kindly, if you use this code then cite either of the following papers:

[1] R. N. Khushaba, A. Al-Jumaily, and A. Al-Ani, “Novel Feature Extraction Method based on Fuzzy Entropy and Wavelet Packet Transform for Myoelectric Control”, 7th International Symposium on Communications and Information Technologies ISCIT2007, Sydney, Australia, pp. 352 – 357.

[2] R. N. Khushaba, S. Kodagoa, S. Lal, and G. Dissanayake, “Driver Drowsiness Classification Using Fuzzy Wavelet Packet Based Feature Extraction Algorithm”, IEEE Transaction on Biomedical Engineering, vol. 58, no. 1, pp. 121-131, 2011.

[3] Ahmed Al-Ani, Rami N. Khushaba, "A Population Based Feature Subset Selection Algorithm Guided by Fuzzy Feature Dependency", AMLTA 2012, CCIS 322, pp. 430–438, 2012.

P.S: Let me know about bugs, if any.

Dr. Rami N. Khushaba
www.rami-khushaba.com

RAMANAND HEGDE

### RAMANAND HEGDE (view profile)

Can somebody please tell me , how we can use this code for measuring entropy of ecg signal?

HONG WANG

### HONG WANG (view profile)

Good~But it is a little time consuming

in function [fea] = mrmr_mid_d(d, f, K,I_Cx,I_xx) what would be the value of I_Cx and I_xx ?

mosab

### mosab (view profile)

Hi every body
I'm working in feature selection with BPSO using Mutual information (By Hanchuan Peng April 16, 2003)
and i have faced problem with code
Error:
Subscript indices must either be real positive integers or logicals.

Error in BPSO (line 47)
fitness=CostFunction(Position(i,:));
can any one help me pleas..

md

### md (view profile)

hello

thank you for sharing it! i have a question i tried your fuzzy code with a signal with gaussian nose and always return de same value

i'm wondering if is possible to read “Novel Feature Extraction Method based on Fuzzy Entropy and Wavelet Packet Transform for Myoelectric Control” for understand how to enter the input signal ..i was looking in internet but i cant find it!

Rami Khushaba

### Rami Khushaba (view profile)

Hi ZoidBerg

Just make sure that your class label, this is the last column in data, is actually organized as 1 2 3 4 etc..., i.e., the label haves consecutive numbering and in that case you can ignore or comment the grp2idx function.

Rami

Zoidberg

### Zoidberg (view profile)

Thanks, but does it require Statistics Toolbox?
I get "Undefined function 'grp2idx' for input arguments of type 'double'".

Rami Khushaba

### Rami Khushaba (view profile)

Hello

For those interested in mutual information based feature selection, you can use this code with the well-known MRMR feature selection algorithm from: http://www.mathworks.com.au/matlabcentral/fileexchange/14916-minimum-redundancy-maximum-relevance-feature-selection

You will have to adjust the fuzzification parameter m to reflect better performance. You will also have to modify the original function by Hanchuan Peng into the following:

==================================

function [fea] = mrmr_mid_d(d, f, K,I_Cx,I_xx)
% MID scheme according to MRMR
% Original By Hanchuan Peng
% April 16, 2003
% Modification By Rami Khushaba
% 13/09/2013

bdisp=0;
nd = size(d,2);
nc = size(d,1);
t1=cputime;
t = I_Cx;
[tmp, idxs] = sort(t,'descend');
fea_base = idxs(1:K);
fea(1) = idxs(1);
KMAX = min(1000,nd); %500
idxleft = idxs(2:KMAX);
k=1;
if bdisp==1,
fprintf('k=1 cost_time=(N/A) cur_fea=%d #left_cand=%d\n', ...
fea(k), length(idxleft));
end;

for k=2:K,
t1=cputime;
ncand = length(idxleft);
curlastfea = length(fea);
for i=1:ncand,
t_mi(i) = I_Cx(idxleft(i));
mi_array(idxleft(i),curlastfea) = I_xx(fea(curlastfea), idxleft(i));
c_mi(i) = mean(mi_array(idxleft(i), :));
end;
[tmp, fea(k)] = max(t_mi(1:ncand) - c_mi(1:ncand));
tmpidx = fea(k); fea(k) = idxleft(tmpidx); idxleft(tmpidx) = [];
if bdisp==1,
fprintf('k=%d cost_time=%5.4f cur_fea=%d #left_cand=%d\n', ...
k, cputime-t1, fea(k), length(idxleft));
end;
end;
return;

Post any question related to fuzzy MI and I will try to reply as soon as possible.

Thanks
Rami

Qasem

Rami Khushaba

### Rami Khushaba (view profile)

You welcome.

Fereshteh Yousefi

### Fereshteh Yousefi (view profile)

many many thanks for your sharing.

Liu Guo

### Liu Guo (view profile)

thank you very much！I got it

Rami Khushaba

### Rami Khushaba (view profile)

Liu, an example is included in the code.

Rami Khushaba

Thanks Ali.

Liu Guo

### Liu Guo (view profile)

Thank you for sharing it.In fact i want to download 'Fuzzy Mutual Information and Fuzzy Entropy '.How use it?

Ali Ali

### Ali Ali (view profile)

Thank you very much Dr. Rami for sharing this great code