File Exchange

image thumbnail

Multiclass GentleAdaboosting

version 1.10 (108 KB) by

A fast Gentle Adaboost classifier with two kind of weaklearners

4.76923
14 Ratings

36 Downloads

Updated

View License

  Gentle AdaBoost Classifier with two different weak-learners : Decision Stump and Perceptron.
  Multi-class problem is performed with the one-vs-all strategy.

  Usage
  ------

  model = gentleboost_model(X , y , [options]);

  
  Inputs
  -------

  X Features matrix (d x N) in double precision
  y Labels vector(1 x N) where y_i={1,...,M} and i=1,...,N.. If y represent binary labels vector then y_i={-1,1}.
  options
              weaklearner Choice of the weak learner used in the training phase
                    weaklearner = 0 <=> minimizing the weighted error : sum(w * |z - h(x;(th,a,b))|^2) / sum(w), where h(x;(th,a,b)) = (a*(x>th) + b) in R
                    weaklearner = 1 <=> minimizing the weighted error : sum(w * |z - h(x;(a,b))|^2), where h(x;(a,b)) = sigmoid(x ; a,b) in R
              T Number of weaklearners (default T = 100)
              epsi Epsilon constant in the sigmoid function used in the perceptron (default epsi = 1.0)
              lambda Regularization parameter for the perceptron's weights update (default lambda = 1e-3)
              max_ite Maximum number of iterations of the perceptron algorithm (default max_ite = 100)
              seed Seed number for internal random generator (default random seed according to time)

If compiled with the "OMP" compilation flag
             num_threads Number of threads. If num_threads = -1, num_threads = number of core (default num_threads = -1)

  Outputs
  -------
  
  model Structure of model ouput

featureIdx Features index in single/double precision of the T best weaklearners (T x m) where m is the number of class.
                    For binary classification m is force to 1.
              th Optimal Threshold parameters (1 x T) in single/double precision.
              a Affine parameter(1 x T) in single/double precision.
              b Bias parameter (1 x T) in single/double precision.
              weaklearner Choice of the weak learner used in the training phase in single/double precision.
              epsi Epsilon constant in the sigmoid function used in the perceptron in single/double precision.

Please run mexme_gentleboost to compile mex-files on your platform.

Please run test_gentleboost_model to run the demo.

N.B. Last build of libsvm is also included and slightly modified to suppress verbose.

Comments and Ratings (46)

Keun Hoo Cho

Balaji Katika

Undefined function 'gentleboost_model' for input arguments of type 'struct'
how to build mex file for gentleboost model

Asma

Asma (view profile)

Hi Sebastien,
I want to use your code for multiclass classification problem using SVM (multilib) as weak classifier. The demo file works, but to my understanding, the final result of boosting will be "one classifier", which is able to predict for the test dataset. Can you please help me that how I can do this using your code (and for SVM as weak learner). Please correct me, if I am wrong.

Ioana

Ioana (view profile)

Yes, win 7 64-bit

Sebastien PARIS

ioana, win 7 64 bits ?

Ioana

Ioana (view profile)

Yes, y is a vector of only 1s or -1s. I am using Windows 7 and my version of Matlab is R2012b.

Sebastien PARIS

iona, is your y vector element are either 1 or -1 ?. What OS are u using ?

Ioana

Ioana (view profile)

I am trying to run your file on data only having 2 labels, but the gentleboost_model outputs a Tx1 value for any of the parameters, instead on Tx2 (since there are 2 labels). I saved my data X as a 31x600 matrix, and y as 1x600 vector, to match the wine dataset that you use as an example. Why is that? I kept everything else in your code unchanged.

xibin

xibin (view profile)

Hi, thanks for your sharing the code. I have a problem when I run mexme_gentleboost to compile mex-files. It can not work, the error is
"Error using mexme_gentleboost>getmexopts (line 217)
getmexopts [Bruno]: cannot open comopts.bat file

Error in mexme_gentleboost (line 80)
    res = getmexopts(mexoptfile);
 ";
I am an amateur in using matlab,
How can I solve it? Thank you~

Wei

Wei (view profile)

I cannot get the multithreaded version to work correctly compiling with the openmp flag both on windows or on Linux. Did anyone successfully use the openmp compiled version to get identical answer compared to the unparalled ones?

sahar

sahar (view profile)

ok thinks,

Sebastien PARIS

Sahar,

Should be a simple Perceptron.

Tarek

Tarek (view profile)

sahar

sahar (view profile)

thanks you.It works now.
I want to know the type of perceptron used in the Classifier Gentle AdaBoost (simple perceptron or multilayer perceptron)
thanks you Sebastien

Sebastien PARIS

sahar,
Please read carefully the requierement. You need a modern CPP compiler. Unfortuntly, the shipped LCC compiler can't compile correctly SVMLIB. Please install MSCV express according to your matlab version

sahar

sahar (view profile)

Hi,I have a error when I run the file mexme_gentleboost.
compiling svmtrain
Error svm.cpp: 12 syntax error; found `<' expecting `;'
Error svm.cpp: 12 skipping `<'
Error svm.cpp: 12 syntax error; found `T' expecting `;'
Error svm.cpp: 12 syntax error; found `>' expecting `;'
Error svm.cpp: 12 skipping `>'
Error svm.cpp: 12 syntax error; found `T' expecting `;'
Error svm.cpp: 12 syntax error; found `min' expecting `;'
Error svm.cpp: 12 syntax error; found `x' expecting `)'
Error svm.cpp: 12 skipping `x' `,' `T' `y'
Error svm.cpp: 14 undeclared identifier `x'
Error svm.cpp: 14 undeclared identifier `y'
Warning svm.cpp: 14 possible usage of y before definition
Warning svm.cpp: 14 possible usage of x before definition
Error svm.cpp: 21 syntax error; found `<' expecting `;'
Error svm.cpp: 21 skipping `<'
Error svm.cpp: 21 syntax error; found `T' expecting `;'
Error svm.cpp: 21 syntax error; found `>' expecting `;'
Error svm.cpp: 21 skipping `>'
Error svm.cpp: 21 syntax error; found `T' expecting `;'
Error svm.cpp: 21 syntax error; found `max' expecting `;'
Error svm.cpp: 21 syntax error; found `x' expecting `)'
Error svm.cpp: 21 skipping `x' `,' `T' `y'
Error svm.cpp: 21 too many errors
 please help me

sahar

sahar (view profile)

hi ,I have a problem when I exceute a example 3 for test_gentleboost_model
??? Invalid MEX-file
'C:\Matlab2010\toolbox\libsvm-3.11\windows\svmtrain.mexw32':
The specified module could not be found.

.

Error in ==> boostsvm at 96
    model_svm =
    svmtrain(ytrain' , Xtrain' , options.strcmd);

hu

hu (view profile)

Sebastien PARIS

Hu,

An update will appear soon with new features. Hope it will solve your problem. Anyway, you should upgrade your compiler and take for example the free MSVC 2008 express for your system

hu

hu (view profile)

Hi,
CPU:Pentium(R) Dual-core E5800 @3.2GHz
compilation details :
mex -v gentleboost_model.c
 This is mex, Copyright 1984-2007 The MathWorks, Inc.
 
-> Default options filename found in C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R2010a
----------------------------------------------------------------
-> Options file = C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R2010a\mexopts.bat
      MATLAB = D:\SOFTWARE\MATLAB\R2010A
-> COMPILER = cl
-> Compiler flags:
         COMPFLAGS = /c /Zp8 /G5 /W3 /EHs /DMATLAB_MEX_FILE /nologo /MD
         OPTIMFLAGS = /O2 /Oy- /DNDEBUG
         DEBUGFLAGS = /Z7
         arguments =
         Name switch = /Fo
-> Pre-linking commands =
-> LINKER = link
-> Link directives:
         LINKFLAGS = /dll /export:mexFunction /LIBPATH:"D:\SOFTWARE\MATLAB\R2010A\extern\lib\win32\microsoft" libmx.lib libmex.lib libmat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MACHINE:IX86 /implib:"C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_9H~1\templib.x" /MAP:"gentleboost_model.mexw32.map" /NOLOGO /INCREMENTAL:NO
         LINKDEBUGFLAGS = /DEBUG /PDB:"gentleboost_model.mexw32.pdb"
         LINKFLAGSPOST =
         Name directive = /out:"gentleboost_model.mexw32"
         File link directive =
         Lib. link directive =
         Rsp file indicator = @
-> Resource Compiler = rc /fo "mexversion.res"
-> Resource Linker =
----------------------------------------------------------------
 
 
--> cl /c /Zp8 /G5 /W3 /EHs /DMATLAB_MEX_FILE /nologo /MD /FoC:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_9H~1\gentleboost_model.obj -ID:\SOFTWARE\MATLAB\R2010A\extern\include -ID:\SOFTWARE\MATLAB\R2010A\simulink\include /O2 /Oy- /DNDEBUG -DMX_COMPAT_32 gentleboost_model.c
 
gentleboost_model.c
gentleboost_model.c(247) : warning C4244: '=' : conversion from 'double ' to 'int ', possible loss of data
gentleboost_model.c(257) : warning C4244: '=' : conversion from 'double ' to 'int ', possible loss of data
gentleboost_model.c(815) : warning C4244: '=' : conversion from 'double ' to 'int ', possible loss of data
gentleboost_model.c(819) : warning C4244: '=' : conversion from 'double ' to 'int ', possible loss of data
    Contents of C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_9H~1\mex_tmp.rsp:
  C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_9H~1\gentleboost_model.obj
 
 
--> link /out:"gentleboost_model.mexw32" /dll /export:mexFunction /LIBPATH:"D:\SOFTWARE\MATLAB\R2010A\extern\lib\win32\microsoft" libmx.lib libmex.lib libmat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MACHINE:IX86 /implib:"C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_9H~1\templib.x" /MAP:"gentleboost_model.mexw32.map" /NOLOGO /INCREMENTAL:NO @C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_9H~1\MEX_TMP.RSP
 
   Creating library C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_9H~1\templib.x and object C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_9H~1\templib.exp
 
--> del "gentleboost_model.mexw32.map"
 
 
--> del "C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_9H~1\templib.x" "C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_9H~1\templib.exp"
 

mex -v gentleboost_predict.c
 This is mex, Copyright 1984-2007 The MathWorks, Inc.
 
-> Default options filename found in C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R2010a
----------------------------------------------------------------
-> Options file = C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R2010a\mexopts.bat
      MATLAB = D:\SOFTWARE\MATLAB\R2010A
-> COMPILER = cl
-> Compiler flags:
         COMPFLAGS = /c /Zp8 /G5 /W3 /EHs /DMATLAB_MEX_FILE /nologo /MD
         OPTIMFLAGS = /O2 /Oy- /DNDEBUG
         DEBUGFLAGS = /Z7
         arguments =
         Name switch = /Fo
-> Pre-linking commands =
-> LINKER = link
-> Link directives:
         LINKFLAGS = /dll /export:mexFunction /LIBPATH:"D:\SOFTWARE\MATLAB\R2010A\extern\lib\win32\microsoft" libmx.lib libmex.lib libmat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MACHINE:IX86 /implib:"C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_NE~1\templib.x" /MAP:"gentleboost_predict.mexw32.map" /NOLOGO /INCREMENTAL:NO
         LINKDEBUGFLAGS = /DEBUG /PDB:"gentleboost_predict.mexw32.pdb"
         LINKFLAGSPOST =
         Name directive = /out:"gentleboost_predict.mexw32"
         File link directive =
         Lib. link directive =
         Rsp file indicator = @
-> Resource Compiler = rc /fo "mexversion.res"
-> Resource Linker =
----------------------------------------------------------------
 
 
--> cl /c /Zp8 /G5 /W3 /EHs /DMATLAB_MEX_FILE /nologo /MD /FoC:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_NE~1\gentleboost_predict.obj -ID:\SOFTWARE\MATLAB\R2010A\extern\include -ID:\SOFTWARE\MATLAB\R2010A\simulink\include /O2 /Oy- /DNDEBUG -DMX_COMPAT_32 gentleboost_predict.c
 
gentleboost_predict.c
    Contents of C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_NE~1\mex_tmp.rsp:
  C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_NE~1\gentleboost_predict.obj
 
 
--> link /out:"gentleboost_predict.mexw32" /dll /export:mexFunction /LIBPATH:"D:\SOFTWARE\MATLAB\R2010A\extern\lib\win32\microsoft" libmx.lib libmex.lib libmat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MACHINE:IX86 /implib:"C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_NE~1\templib.x" /MAP:"gentleboost_predict.mexw32.map" /NOLOGO /INCREMENTAL:NO @C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_NE~1\MEX_TMP.RSP
 
   Creating library C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_NE~1\templib.x and object C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_NE~1\templib.exp
 
--> del "gentleboost_predict.mexw32.map"
 
 
--> del "C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_NE~1\templib.x" "C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_NE~1\templib.exp"
 

mex -DranSHR3 -v srng_model.c
 This is mex, Copyright 1984-2007 The MathWorks, Inc.
 
-> Default options filename found in C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R2010a
----------------------------------------------------------------
-> Options file = C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R2010a\mexopts.bat
      MATLAB = D:\SOFTWARE\MATLAB\R2010A
-> COMPILER = cl
-> Compiler flags:
         COMPFLAGS = /c /Zp8 /G5 /W3 /EHs /DMATLAB_MEX_FILE /nologo /MD
         OPTIMFLAGS = /O2 /Oy- /DNDEBUG
         DEBUGFLAGS = /Z7
         arguments = -DranSHR3
         Name switch = /Fo
-> Pre-linking commands =
-> LINKER = link
-> Link directives:
         LINKFLAGS = /dll /export:mexFunction /LIBPATH:"D:\SOFTWARE\MATLAB\R2010A\extern\lib\win32\microsoft" libmx.lib libmex.lib libmat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MACHINE:IX86 /implib:"C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_C6~1\templib.x" /MAP:"srng_model.mexw32.map" /NOLOGO /INCREMENTAL:NO
         LINKDEBUGFLAGS = /DEBUG /PDB:"srng_model.mexw32.pdb"
         LINKFLAGSPOST =
         Name directive = /out:"srng_model.mexw32"
         File link directive =
         Lib. link directive =
         Rsp file indicator = @
-> Resource Compiler = rc /fo "mexversion.res"
-> Resource Linker =
----------------------------------------------------------------
 
 
--> cl -DranSHR3 /c /Zp8 /G5 /W3 /EHs /DMATLAB_MEX_FILE /nologo /MD /FoC:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_C6~1\srng_model.obj -ID:\SOFTWARE\MATLAB\R2010A\extern\include -ID:\SOFTWARE\MATLAB\R2010A\simulink\include /O2 /Oy- /DNDEBUG -DMX_COMPAT_32 srng_model.c
 
srng_model.c
srng_model.c(455) : warning C4244: '=' : conversion from 'double ' to 'int ', possible loss of data
srng_model.c(465) : warning C4018: '!=' : signed/unsigned mismatch
srng_model.c(526) : warning C4244: '=' : conversion from 'double ' to 'int ', possible loss of data
srng_model.c(812) : warning C4018: '!=' : signed/unsigned mismatch
srng_model.c(1541) : warning C4244: '=' : conversion from 'double ' to 'unsigned long ', possible loss of data
srng_model.c(1557) : warning C4244: '=' : conversion from 'double ' to 'unsigned long ', possible loss of data
srng_model.c(1613) : warning C4018: '<' : signed/unsigned mismatch
srng_model.c(1637) : warning C4018: '<' : signed/unsigned mismatch
    Contents of C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_C6~1\mex_tmp.rsp:
  C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_C6~1\srng_model.obj
 
 
--> link /out:"srng_model.mexw32" /dll /export:mexFunction /LIBPATH:"D:\SOFTWARE\MATLAB\R2010A\extern\lib\win32\microsoft" libmx.lib libmex.lib libmat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MACHINE:IX86 /implib:"C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_C6~1\templib.x" /MAP:"srng_model.mexw32.map" /NOLOGO /INCREMENTAL:NO @C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_C6~1\MEX_TMP.RSP
 
   Creating library C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_C6~1\templib.x and object C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_C6~1\templib.exp
 
--> del "srng_model.mexw32.map"
 
 
--> del "C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_C6~1\templib.x" "C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_C6~1\templib.exp"
 

mex -v NN_predict.c
 This is mex, Copyright 1984-2007 The MathWorks, Inc.
 
-> Default options filename found in C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R2010a
----------------------------------------------------------------
-> Options file = C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R2010a\mexopts.bat
      MATLAB = D:\SOFTWARE\MATLAB\R2010A
-> COMPILER = cl
-> Compiler flags:
         COMPFLAGS = /c /Zp8 /G5 /W3 /EHs /DMATLAB_MEX_FILE /nologo /MD
         OPTIMFLAGS = /O2 /Oy- /DNDEBUG
         DEBUGFLAGS = /Z7
         arguments =
         Name switch = /Fo
-> Pre-linking commands =
-> LINKER = link
-> Link directives:
         LINKFLAGS = /dll /export:mexFunction /LIBPATH:"D:\SOFTWARE\MATLAB\R2010A\extern\lib\win32\microsoft" libmx.lib libmex.lib libmat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MACHINE:IX86 /implib:"C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_XQ~1\templib.x" /MAP:"NN_predict.mexw32.map" /NOLOGO /INCREMENTAL:NO
         LINKDEBUGFLAGS = /DEBUG /PDB:"NN_predict.mexw32.pdb"
         LINKFLAGSPOST =
         Name directive = /out:"NN_predict.mexw32"
         File link directive =
         Lib. link directive =
         Rsp file indicator = @
-> Resource Compiler = rc /fo "mexversion.res"
-> Resource Linker =
----------------------------------------------------------------
 
 
--> cl /c /Zp8 /G5 /W3 /EHs /DMATLAB_MEX_FILE /nologo /MD /FoC:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_XQ~1\NN_predict.obj -ID:\SOFTWARE\MATLAB\R2010A\extern\include -ID:\SOFTWARE\MATLAB\R2010A\simulink\include /O2 /Oy- /DNDEBUG -DMX_COMPAT_32 NN_predict.c
 
NN_predict.c
NN_predict.c(193) : warning C4018: '!=' : signed/unsigned mismatch
NN_predict.c(210) : warning C4018: '!=' : signed/unsigned mismatch
    Contents of C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_XQ~1\mex_tmp.rsp:
  C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_XQ~1\NN_predict.obj
 
 
--> link /out:"NN_predict.mexw32" /dll /export:mexFunction /LIBPATH:"D:\SOFTWARE\MATLAB\R2010A\extern\lib\win32\microsoft" libmx.lib libmex.lib libmat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MACHINE:IX86 /implib:"C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_XQ~1\templib.x" /MAP:"NN_predict.mexw32.map" /NOLOGO /INCREMENTAL:NO @C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_XQ~1\MEX_TMP.RSP
 
   Creating library C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_XQ~1\templib.x and object C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_XQ~1\templib.exp
 
--> del "NN_predict.mexw32.map"
 
 
--> del "C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_XQ~1\templib.x" "C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_XQ~1\templib.exp"
 

mex -v svmtrain.c svm.cpp svm_model_matlab.c
 This is mex, Copyright 1984-2007 The MathWorks, Inc.
 
-> Default options filename found in C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R2010a
----------------------------------------------------------------
-> Options file = C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R2010a\mexopts.bat
      MATLAB = D:\SOFTWARE\MATLAB\R2010A
-> COMPILER = cl
-> Compiler flags:
         COMPFLAGS = /c /Zp8 /G5 /W3 /EHs /DMATLAB_MEX_FILE /nologo /MD
         OPTIMFLAGS = /O2 /Oy- /DNDEBUG
         DEBUGFLAGS = /Z7
         arguments =
         Name switch = /Fo
-> Pre-linking commands =
-> LINKER = link
-> Link directives:
         LINKFLAGS = /dll /export:mexFunction /LIBPATH:"D:\SOFTWARE\MATLAB\R2010A\extern\lib\win32\microsoft" libmx.lib libmex.lib libmat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MACHINE:IX86 /implib:"C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_VR~1\templib.x" /MAP:"svmtrain.mexw32.map" /NOLOGO /INCREMENTAL:NO
         LINKDEBUGFLAGS = /DEBUG /PDB:"svmtrain.mexw32.pdb"
         LINKFLAGSPOST =
         Name directive = /out:"svmtrain.mexw32"
         File link directive =
         Lib. link directive =
         Rsp file indicator = @
-> Resource Compiler = rc /fo "mexversion.res"
-> Resource Linker =
----------------------------------------------------------------
 
 
--> cl /c /Zp8 /G5 /W3 /EHs /DMATLAB_MEX_FILE /nologo /MD /FoC:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_VR~1\svmtrain.obj -ID:\SOFTWARE\MATLAB\R2010A\extern\include -ID:\SOFTWARE\MATLAB\R2010A\simulink\include /O2 /Oy- /DNDEBUG -DMX_COMPAT_32 svmtrain.c
 
svmtrain.c
 
--> cl /c /Zp8 /G5 /W3 /EHs /DMATLAB_MEX_FILE /nologo /MD /FoC:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_VR~1\svm.obj -ID:\SOFTWARE\MATLAB\R2010A\extern\include -ID:\SOFTWARE\MATLAB\R2010A\simulink\include /O2 /Oy- /DNDEBUG -DMX_COMPAT_32 svm.cpp
 
svm.cpp
 
--> cl /c /Zp8 /G5 /W3 /EHs /DMATLAB_MEX_FILE /nologo /MD /FoC:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_VR~1\svm_model_matlab.obj -ID:\SOFTWARE\MATLAB\R2010A\extern\include -ID:\SOFTWARE\MATLAB\R2010A\simulink\include /O2 /Oy- /DNDEBUG -DMX_COMPAT_32 svm_model_matlab.c
 
svm_model_matlab.c
    Contents of C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_VR~1\mex_tmp.rsp:
  C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_VR~1\svmtrain.obj C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_VR~1\svm.obj C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_VR~1\svm_model_matlab.obj
 
 
--> link /out:"svmtrain.mexw32" /dll /export:mexFunction /LIBPATH:"D:\SOFTWARE\MATLAB\R2010A\extern\lib\win32\microsoft" libmx.lib libmex.lib libmat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MACHINE:IX86 /implib:"C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_VR~1\templib.x" /MAP:"svmtrain.mexw32.map" /NOLOGO /INCREMENTAL:NO @C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_VR~1\MEX_TMP.RSP
 
   Creating library C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_VR~1\templib.x and object C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_VR~1\templib.exp
 
--> del "svmtrain.mexw32.map"
 
 
--> del "C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_VR~1\templib.x" "C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_VR~1\templib.exp"
 

mex -v svmpredict.c svm.cpp svm_model_matlab.c
 This is mex, Copyright 1984-2007 The MathWorks, Inc.
 
-> Default options filename found in C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R2010a
----------------------------------------------------------------
-> Options file = C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R2010a\mexopts.bat
      MATLAB = D:\SOFTWARE\MATLAB\R2010A
-> COMPILER = cl
-> Compiler flags:
         COMPFLAGS = /c /Zp8 /G5 /W3 /EHs /DMATLAB_MEX_FILE /nologo /MD
         OPTIMFLAGS = /O2 /Oy- /DNDEBUG
         DEBUGFLAGS = /Z7
         arguments =
         Name switch = /Fo
-> Pre-linking commands =
-> LINKER = link
-> Link directives:
         LINKFLAGS = /dll /export:mexFunction /LIBPATH:"D:\SOFTWARE\MATLAB\R2010A\extern\lib\win32\microsoft" libmx.lib libmex.lib libmat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MACHINE:IX86 /implib:"C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_2W~1\templib.x" /MAP:"svmpredict.mexw32.map" /NOLOGO /INCREMENTAL:NO
         LINKDEBUGFLAGS = /DEBUG /PDB:"svmpredict.mexw32.pdb"
         LINKFLAGSPOST =
         Name directive = /out:"svmpredict.mexw32"
         File link directive =
         Lib. link directive =
         Rsp file indicator = @
-> Resource Compiler = rc /fo "mexversion.res"
-> Resource Linker =
----------------------------------------------------------------
 
 
--> cl /c /Zp8 /G5 /W3 /EHs /DMATLAB_MEX_FILE /nologo /MD /FoC:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_2W~1\svmpredict.obj -ID:\SOFTWARE\MATLAB\R2010A\extern\include -ID:\SOFTWARE\MATLAB\R2010A\simulink\include /O2 /Oy- /DNDEBUG -DMX_COMPAT_32 svmpredict.c
 
svmpredict.c
 
--> cl /c /Zp8 /G5 /W3 /EHs /DMATLAB_MEX_FILE /nologo /MD /FoC:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_2W~1\svm.obj -ID:\SOFTWARE\MATLAB\R2010A\extern\include -ID:\SOFTWARE\MATLAB\R2010A\simulink\include /O2 /Oy- /DNDEBUG -DMX_COMPAT_32 svm.cpp
 
svm.cpp
 
--> cl /c /Zp8 /G5 /W3 /EHs /DMATLAB_MEX_FILE /nologo /MD /FoC:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_2W~1\svm_model_matlab.obj -ID:\SOFTWARE\MATLAB\R2010A\extern\include -ID:\SOFTWARE\MATLAB\R2010A\simulink\include /O2 /Oy- /DNDEBUG -DMX_COMPAT_32 svm_model_matlab.c
 
svm_model_matlab.c
    Contents of C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_2W~1\mex_tmp.rsp:
  C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_2W~1\svmpredict.obj C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_2W~1\svm.obj C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_2W~1\svm_model_matlab.obj
 
 
--> link /out:"svmpredict.mexw32" /dll /export:mexFunction /LIBPATH:"D:\SOFTWARE\MATLAB\R2010A\extern\lib\win32\microsoft" libmx.lib libmex.lib libmat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MACHINE:IX86 /implib:"C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_2W~1\templib.x" /MAP:"svmpredict.mexw32.map" /NOLOGO /INCREMENTAL:NO @C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_2W~1\MEX_TMP.RSP
 
   Creating library C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_2W~1\templib.x and object C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_2W~1\templib.exp
 
--> del "svmpredict.mexw32.map"
 
 
--> del "C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_2W~1\templib.x" "C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_2W~1\templib.exp"
 

echo off

Sebastien PARIS

The compilation process works fine ?.
Can you add the -v option in the mex command add give me the compilation details for gentleboost_predict.c ?. What is your CPU ?

hu

hu (view profile)

Hi,
I have run mexme_gentleboost.m, but error still exist.

Sebastien PARIS

Please recompile mex-files on your own system via mexme_gentleboost.m

hu

hu (view profile)

Sebastien,
My OS is windows XP 32bit
My C compiler is Microsoft Visual C++ 6.0

Sebastien PARIS

hu,

What is your OS and C compiler ?

hu

hu (view profile)

Hi, Sebastian:
My matlab version is 2010a, and when I called gentleboost_predict.c, I had got a "Segmentation violation detected" error, for options I used default value, I don't know how to do with it
I would be grateful for your help

Ishrat Badami

Dear Sebastian,

Is it possible to use cross-valisation in the code?

best
Ishrat

Xinzhu Wang

thank you for your codes

Sebastien PARIS

Please use Visual express to compile svm files. It's free ... 2005 express for current version of matlab

Frank

Frank (view profile)

Error in ==> mexme_gentleboost at 11
mex svmtrain.c svm.cpp svm_model_matlab.c

matlab 7.7

compiler:
[1] Lcc-win32 C 2.4.1 in C:\PROGRA~1\MATLAB\R2008b\sys\lcc

esra

esra (view profile)

Hi Sebastian, ok now I am using matlab 7,4; win32, c++. Giving error during compiling in SVM ? Could you give me you email to ask some questions about multi-classifictaion in adaboost? regards

Sebastien PARIS

esra : OS ? CPU ? Compiler ? Matlab Version ?

esra

esra (view profile)

I couldn't compile the svm files..!! Any reason why? I thought it is conflicting with svm in matlab lib itself, i changed the names but still I couldn't compile it. Any more ideas are welcome

esra

esra (view profile)

I meant : I guess Matlab 10 is not suitable at all. Regards

Samuel

Samuel (view profile)

Samuel

Samuel (view profile)

Compiled on 32 bit Ubuntu linux after changing some files to .cpp. It will complain about using "//" to coment, which is not supported in my case.

This did not work in the file "srng_model.c", so I manually changed all those comments from "//" to "/* comment here */"

Dan An

Dan An (view profile)

Dan An

Dan An (view profile)

Excellent work!

Which is the paper you implemented this code from?
What is the relationship between weak learners and the lines number 'd'. Intuitively I would have said, it should be the same?
If I use this work in a publication, what do I cite / link? I didn't find anything in the licence file...

Thank you!

Sebastien PARIS

Lei : I tested on 7/64 and it works fine.

N.B I added the -largeArrayDims flag for the svm files.

Sebastien PARIS

To kayhan : look top of the gentleboos_model.c :
weaklearner : Choice of the weak learner used in the training phase

weaklearner = 0 <=> minimizing the weighted error : sum(w * |z - h(x;(th,a,b))|^2) / sum(w), where h(x;(th,a,b)) = (a*(x>th) + b),

weaklearner = 1 <=> minimizing the weighted error : sum(w * |z - h(x;(a,b))|^2), where h(x;(a,b)) = sigmoid(x ; a,b) in R

The strong classifier is nothing else thant the sum of each trained weaklearner.

For Lei : Different results in 64 bits ?. I didn't test before.I'll look forward this issue. Thanks for reporting

Lei

Lei (view profile)

Thank you for sharing the code, Sebastian. Very nice work.
I'm using XP 64bit system, which produces very different (actually much worse) results with the examples in test_gentleboost_model.m.
Can you help on this?

Thanks a lot,

Kayhan

Kayhan (view profile)

Thank you for sharing it. A few points:

1. Please correct me if I am wrong: I guess the model should contain weights of the hypothesis too, right? Otherwise, how do you combine the hypothesis in the prediction function?

2. If you change the extensions of the .c files to .cpp, they get compiled in Linux too. They will complain about a few void* to double* conversion which can be fixed by reinterpret_cast<double *> (...) before the expressions.

AMVR

AMVR (view profile)

Thank you Sebastien. I realized that soon after posting the comment.

By the way, do you know of any libraries or implementations that could be used to do probability calibration on the output of boosting? Something such as logistic correction, platt scaling or isotonic regression (see "Obtaining Calibrated Probabilities from Boosting", by Alexandru Niculescu-Mizil and Rich Caruana for context)

Sebastien PARIS

Probably du to // comments not supported directly with gcc.

Please add "CFLAGS="\$CFLAGS -std=99" after each mex command in mexme_gentleboost.m
ex : mex gentleboost_model.c CFLAGS="\$CFLAGS -std=99"

AMVR

AMVR (view profile)

This is a promising contribution, Sebastian. Thanks for uploading it.

I managed to compile your code in Win 7 64 bit, but I am getting compilation errors in Linux.

What is -DranSHR3 for?

Updates

1.10

-Change inputs/outputs parsing
-Add OpenMP support for Multicores CPU
-Add online help
-Add single/double precision support

1.7

-Fixed bug for Linux64 & GCC

1.6

Remove GNU licence in auroc.m

1.5

Remove BSD licence file

1.4

-BSD licence

1.2

- Correct a small bug in the perceptron weaklearner
- Speed improvement of 10% for the decision stump weaklearner

1.1

- Update qs and qsindex with a better version of the algorithm

MATLAB Release
MATLAB 7.5 (R2007b)

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

» Watch video