File Exchange

image thumbnail

minimum-redundancy maximum-relevance feature selection

version 1.0 (3.06 KB) by

The source codes of minimum redundancy feature selection

9 Ratings



No License

Two source code files of the mRMR (minimum-redundancy maximum-relevancy) feature selection method in (Peng et al, 2005 and Ding & Peng, 2005, 2003), whose better performance over the conventional top-ranking method has been demonstrated on a number of data sets in recent publications. This version uses mutual information as a proxy for computing relevance and redundancy among variables (features). Other variations such as using correlation or F-test or distances can be easily implemented within this framework, too.

Hanchuan Peng, Fuhui Long, and Chris Ding, "Feature selection based on mutual information: criteria of max-dependency, max-relevance, and min-redundancy,"
IEEE Transactions on Pattern Analysis and Machine Intelligence,
Vol. 27, No. 8, pp.1226-1238, 2005.

Ding C., and Peng HC, "Minimum redundancy feature selection from microarray gene expression data," Journal of Bioinformatics and Computational Biology,
Vol. 3, No. 2, pp.185-205, 2005.

Ding, C and Peng HC, Proc. 2nd IEEE Computational Systems Bioinformatics Conference (CSB 2003),
pp.523-528, Stanford, CA, Aug, 2003.

** Note that you need to download the mutual information computing toolbox of the same author. ***

Comments and Ratings (18)


Code is great thank you for the posting.

Hi All,

For those who can't run the files because of 'undefined function' error. You need to:

FIRST AND FOREMOST: you need Mutual Information Computation toolbox provided by the same author. Here is the link:

1) Run this command: list = dir('*.cpp');
to get the list of files.

2) For all the files in list, change log(2) to log(2.0). You can get all the files' names by:

for i=1:length(list)

2) Run 'makeosmex.m'

I am also getting the same error as anyone:

Undefined function 'estpab' for input arguments of type

Error in mutualinfo (line 21)
[p12, p1, p2] = estpab(vec1,vec2);

Error in demo_mi (line 25)

I changed the log(2) -> log(2.0)
but still the same error
I am using 64 bit 2014a MATLAB on WIn 7
Please tell mw how to fix it.

kirti khemka

hi i wrote the same code in matlab it shows the error
Input argument "d" is undefined.
Error in ==> mrmr_mid_d at 9
nd = size(d,2);
where i am going wrong



Madi (view profile)


there are no function 'mutualinfo'..

Please advice, Thanks


Yu (view profile)


can anyone give me example on simple dataset and using mRMR to select features mathematically,to understand this code?

Hi Pranav,

You will need to recompile the Mutual Information toolbox for your system. Use the makeosmex.m file to do so.



Pranav (view profile)

Can someone please help or point me to right direction?


Pranav (view profile)

How to fix following error?

Undefined function 'estpab' for input arguments of type 'uint8'.

Error in mutualinfo (line 21)
[p12, p1, p2] = estpab(vec1,vec2);

Error in mrmr_mid_d (line 49)
   t(i) = mutualinfo(d(:,i), f);

Rami Khushaba

Rami Khushaba (view profile)


For those having problems with compiling the MI toolbox in Matlab, you can now use the Fuzzy Mutual information toolbox available at:

You will have to play with the fuzzification parameter m if you didn't like the performance much. 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

nd = size(d,2);
nc = size(d,1);
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);
if bdisp==1,
fprintf('k=1 cost_time=(N/A) cur_fea=%d #left_cand=%d\n', ...
      fea(k), length(idxleft));

for k=2:K,
   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), :));
   [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));

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


Please tell me how to use it.
I have the term-document matrix(i used tmg tool box to generate it) of type double and i m unable to pass it as the first parameter to the function in mrmr_mid_d.m .
I have to apply this on a text data set.
Please help!!

Jing Wang All files and possible problems and answers could be seen in this webpage. Good luck!

Fatemeh Saki

I have downloaded the mutual information toolbox too, but when I try to call either mrmr_mid_d or mrmr_miq_d, matlab gives me the following error message:
"??? Undefined command/function 'mutualinfo'."
What can be the cause?
Any help appreciated. Thanks in advance.

eta eta

i need it

Senoussi Hafida

Thank's for the source but I've not find the function mutualinfo in matlab R12 thus I can not run the algorithm. please can you help me.

Tom Kallios

nice work and the detected features are good. Should be better if the mutual info tools were put together ...

Kim Duncan

MATLAB Release
MATLAB 6.0 (R12)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video