Project details for MIToolbox

Logo MIToolbox 2.1

by apocock - June 30, 2014, 01:05:57 CET [ Project Homepage BibTeX BibTeX for corresponding Paper Download ]

view (1 today), download ( 1 today ), 14 comments, 3 subscriptions


A mutual information library for C/C++ and Mex bindings for MATLAB.

This toolbox is aimed at people who wish to use mutual information for feature selection, and provides a range of information theoretic functions. All functions estimate the probabilities from the supplied data vectors. Some example implementations of common mutual information based feature selection algorithms are provided in both C and MATLAB, CMIM - (Fleuret 2004), mRMR - (Peng et al 2005), DISR - (Bontempi & Meyer 2006). The implementations contained in here are early versions of those in the FEAST library, and the implementations in FEAST should be used in preference to the ones in MIToolbox.

All functions discretise the inputs by rounding down to the nearest integer.

This toolbox was developed to support our work in feature selection, which resulted in the paper "Conditional Likelihood Maximisation: A Unifying Framework for Information Theoretic Feature Selection", G Brown, A Pocock, M-J Zhao, M Lujan. JMLR 2012 (link). Please cite this paper if you use our toolbox.

The feature selection algorithms developed for that paper form the FEAST toolbox, published at mloss here.

List of functions: Entropy, Conditional Entropy, Joint Entropy, Mutual Information, Conditional Mutual Information, Renyi's Entropy, Renyi's Mutual Information, Weighted Entropy, Weighted Conditional Entropy Creating a joint random variable

A Java implementation of the Shannon entropy functions is available from my GitHub page here.

Changes to previous version:

Added weighted entropy functions. Fixed a few memory handling bugs.

BibTeX Entry: Download
Corresponding Paper BibTeX Entry: Download
URL: Project Homepage
Supported Operating Systems: Linux, Macosx, Windows
Data Formats: Matlab
Tags: Conditional Entropy, Conditional Mutual Information, Entropy, Mutual Information, Renyi Entropy
Archive: download here

Other available revisons

Version Changelog Date

Major refactor of code and reorganised the repository so it's a little more sensible.

  • Refactored all C functions to expose a version which takes unsigned integer inputs.
  • Rearranged the repository to separate out headers from source, and MATLAB code from C library code.

Minor changes:

  • General code cleanup to reduce duplicated code.
  • Adding an COMPILE_R flag to go with the COMPILE_C flag, to make it easier to produce an R wrapper.
  • All code now compiles cleanly with "-std=c89 -Wall -Werror".
January 8, 2017, 00:43:22

Relicensed as BSD. Added checks to catch MATLAB inputs that aren't doubles.

January 10, 2016, 22:19:30

Added weighted entropy functions. Fixed a few memory handling bugs.

June 30, 2014, 01:05:57

Updated documentation & link to JMLR publication.

February 13, 2012, 19:45:07

Initial Announcement on

August 3, 2011, 20:58:19


Aida Brank (on September 22, 2016, 20:11:50)


I have following error:

Undefined function or variable 'FSToolboxMex'. Error in feast (line 70) selectedFeatures = FSToolboxMex(4,numToSelect,data,labels);

though I did as I run ComlileMIToolbox.m in MIToolbox directory.



Adam Pocock (on September 22, 2016, 22:09:08)

Hi Aida,

That error means you haven't compiled FEAST correctly. You need to compile both FEAST and MIToolbox separately.



Fazeelat Mazhar (on February 7, 2017, 08:54:10)

Hi Adam,

I am facing error in running CompileMIToolbox.m file on MATLAB. Error is:

Error using mex CalculateProbability.c C:UsersFazeelatDownloadsMIToolbox-3.0.0MIToolbox-3.0.0srcCalculateProbability.c(271) : error C2275: 'ProbabilityState' : illegal use of this type as an expression ../includeMIToolbox/CalculateProbability.h(40) : see declaration of 'ProbabilityState' C:UsersFazeelatDownloadsMIToolbox-3.0.0MIToolbox-3.0.0srcCalculateProbability.c(271) : error C2146: syntax error : missing ';' before identifier 'state' C:UsersFazeelatDownloadsMIToolbox-3.0.0MIToolbox-3.0.0srcCalculateProbability.c(271) : error C2065: 'state' : undeclared identifier C:UsersFazeelatDownloadsMIToolbox-3.0.0MIToolbox-3.0.0srcCalculateProbability.c(271) : error C2440: '=' : cannot convert from 'ProbabilityState' to 'int' C:UsersFazeelatDownloadsMIToolbox-3.0.0MIToolbox-3.0.0srcCalculateProbability.c(276) : error C2065: 'state' : undeclared identifier C:UsersFazeelatDownloadsMIToolbox-3.0.0MIToolbox-3.0.0srcCalculateProbability.c(276) : error C2440: 'return' : cannot convert from 'int' to 'ProbabilityState'

Adam Pocock (on February 7, 2017, 14:58:04)

Hi Fazeelat,

What C compiler, Matlab version and Windows version are you using?



Fazeelat Mazhar (on February 8, 2017, 05:02:06)

C compiler, Microsoft Visual studio 2010 Matlab version 8.4 Windows 8.1

Adam Pocock (on February 9, 2017, 02:41:55)

Hi Fazeelat,

Turns out there was one place where I didn't strictly follow ANSI C. GCC wasn't throwing an error, but apparently Visual Studio does. I've fixed it now, can you try version 3.0.1 from my GitHub page.



Fazeelat Mazhar (on February 9, 2017, 06:20:30)

Thanks Adam, that error has been fixed.

Another error of out of memory appeared while finding MI of two matrices. My dataset is a bit large dimension i.e.,146X16.

Can you help?

Adam Pocock (on February 9, 2017, 16:08:59)

Hi Fazeelat,

MIToolbox isn't really suitable for that kind of mutual information estimation. You need many more samples to do discrete entropy estimation in a 16 dimensional space, and the mutual information will work in a 32 dimensional space (assuming both your matrices are the same size).

If you have a continuous space you might have more luck with a continuous MI estimator using a k-nn or minimum spanning tree approximation, but MIToolbox doesn't implement either of those. I think Zoltan Szabo's ITE toolkit might be more appropriate.



Fazeelat Mazhar (on February 10, 2017, 07:05:12)

Thanks Adam.

Janek Janek (on February 20, 2017, 18:56:54)

Adam. Please Help me. This problem

Matlab R2016a Windows7 I try wersion 3.0.1


Adam Pocock (on February 20, 2017, 19:14:21)

Hi Janek,

Please check that CompileFEAST is pointing at v3.0.1 of MIToolbox. The version that is packaged in the MLOSS download is v3.0.0 which has that bug. You'll need to download MIToolbox v3.0.1 from Github and unpack it in the directory next to FEAST.



Janek Janek (on February 20, 2017, 19:51:15)


Help Gee I do not understand You can check it's toolbox I use this Please check whether it is good in the toolbox



Adam Pocock (on February 20, 2017, 20:04:32)

Hi Janek,

You haven't unpacked the updated version of MIToolbox in the right directory. The error message from MATLAB shows it's looking in the directory above FEAST, not inside the FEAST directory.

The zip you sent compiles fine on my Linux box from within the FEAST/matlab directory. I don't have access to a copy of Matlab on Windows with Visual Studio to test it out further.



Janek Janek (on February 20, 2017, 20:36:48)

Hi Adam,

I fixed thanks for your help.



Leave a comment

You must be logged in to post comments.