October 28, 2014

Matlab libsvm Mac Yosemite

After upgrading to Mac Yosemite things don't work as expected and Matlab doesn't run any more. So here is the fix:

1) in finder edit Macintosh HD\System\Library\CoreServices\SystemVersion.plist change
from 10.10. Matlab will run but this causes some programs not to run. so after using matlab make sure you change it back to its original values which was 10.10

2) download libsvm
$ cd libsvm
$ make
$ cd matlab
$ matlab -nodisplay
$ mex -setup
$ make
to fix errors on make:

A4. MATLAB's types are not compatible with the newest version of clang. Hopefully they will get in sync soon, but for now I've decided the best fix is to edit the twmtypes.h file:
/*typedef char16_t CHAR16_T;*/
typedef UINT16_T CHAR16_T; 
vim /opt/zshare/zproject/apps/MATLAB_R2013a.app/extern/include/tmwtypes.h 
vim /opt/zshare/zproject/apps/MATLAB_R2013a.app/bin/mexopts.sh  
 around line 120 which is configuration about maci64 change 10.7 to 10.9. it should be 4-5 of these
These links might also be useful

once installed 
download heart scale from http://www.csie.ntu.edu.tw/~b91082/SVM/
load the mat file in matlab 
>> addpath('/opt/zshare/zproject/apps/libsvm-3.19/matlab');
>> model = svmtrain(heart_scale_label,heart_scale_inst,'-c 1 -g 0.07');
optimization finished, #iter = 134
nu = 0.433785
obj = -101.855060, rho = 0.426412
nSV = 130, nBSV = 107
Total nSV = 130

model = 

    Parameters: [5x1 double]
      nr_class: 2
       totalSV: 130
           rho: 0.4264
         Label: [2x1 double]
    sv_indices: [130x1 double]
         ProbA: []
         ProbB: []
           nSV: [2x1 double]
       sv_coef: [130x1 double]
           SVs: [130x13 double]
If your output match the output above, then congratulations, you could use the libsvm now.


No comments:

Post a Comment