Skip to content

Latest commit

 

History

History

matlab

matlab

This directory contains the matlab/octave code.

Files:

  • rembed.m: randomized embedding code. Given features X and labels Y, computes the top right singular vectors of (UXT Y), where UX are the left singular vectors of X.
  • calmultimls.m: (primal approximation to) kernel multiclass and multilabel fitting routine. uses preconditioned SGD.

To see examples of these two routines composed to solve problems, look at the multilabel experiments in ../mulan and the multiclass experiment in ../aloi.

compiling the mex

If you are using matlab, you should compile the mex to make everything go faster. Hopefully you can just type

make NUM_THREADS=6

and all the mex will be compiled for you. Adjust NUM_THREADS based upon how much parallelism is appropriate for your setup. (Sorry, it's not cool enough to auto-detect this).

If you lack a reasonable shell environment, you can execute the mex commands directly from matlab, e.g., under Windows:

>> mex OPTIMFLAGS="/O2" -largeArrayDims -DNUM_THREADS=2 -lmwblas -lmwlapack sparsequad.cpp
Building with 'Microsoft Visual C++ 2012'.
MEX completed successfully.
>> mex OPTIMFLAGS="/O2" -largeArrayDims -DNUM_THREADS=2 -lmwblas -lmwlapack dmsm.cpp
Building with 'Microsoft Visual C++ 2012'.
MEX completed successfully.
>> mex OPTIMFLAGS="/O2" -largeArrayDims -DNUM_THREADS=2 -lmwblas -lmwlapack sparseweightedsum.cpp
Building with 'Microsoft Visual C++ 2012'.
MEX completed successfully.
>> mex OPTIMFLAGS="/O2" -largeArrayDims -DNUM_THREADS=2 -lmwblas -lmwlapack chofactor.cpp
Building with 'Microsoft Visual C++ 2012'.
MEX completed successfully.
>> mex OPTIMFLAGS="/O2" -largeArrayDims -DNUM_THREADS=2 -lmwblas -lmwlapack chosolve.cpp
Building with 'Microsoft Visual C++ 2012'.
MEX completed successfully.
>> mex OPTIMFLAGS="/O2" -largeArrayDims -DNUM_THREADS=2 -lmwblas -lmwlapack fastexpprob.cpp
Building with 'Microsoft Visual C++ 2012'.
MEX completed successfully.
>> mex OPTIMFLAGS="/O2" -largeArrayDims -DNUM_THREADS=2 -lmwblas -lmwlapack fastsoftmax.cpp
Building with 'Microsoft Visual C++ 2012'.
MEX completed successfully.