Matlab MultiClass MultiTask Learning (MCMTL) toolbox. Partitions multiclass, multitask labeled data into one-vs-one or one-vs-rest multitask classification problems.

Matlab MultiClass MultiTask Learning (MCMTL) toolbox.


This toolbox provides MATLAB code to decompose a multi-class, multi-task learning problem into a set of 1vs1 or 1vsRest binary, multi-task subproblems, which are combined to generate multi-class, multi-task predictions via majority vote (1vs1) or maximum likelihood (1vsRest).

Example learning and prediction functions are provided for the MALSAR (Multi-tAsk Learning via StructurAl Regularization) toolbox in the src/MALSAR directory. The MALSAR toolbox is available at:

System Requirements

Tested using Matlab (R2012a) on a Macbook Pro running OSX 10.6.


Run the following code to add the MCMTL functions to your path:

savepath; % optional 

Example Usage

Data: given tasks Ti, each an [nTi x n] matrix, with [nTi x 1] vector labels TLi, i \in [0,2], generate predictions for task T0 and T3 using training data from tasks T0 and T1.

mtlXtr = {T0,T1};  % training tasks
mtlytr = {TL0,TL1}; % training task labels
mtlXte = {T0,T1,T2};  % test tasks
mtlyte = {TL0,TL1,TL2}; % test task labels

Define mcmtl parameters

mcmtl_parms = struct('mctype',mcmtl_mctype,'balance',mcmtl_balance,'verbose',1,'nfold',mcmtl_nfold);

Set up MALSAR learning and prediction functions

malsar_method = 'Trace'; % 'L21';  % use trace norm regularization
malsar_parm = struct('method',malsar_method,'verbose',0,'nsplit',1);
mcmtl_learnfn = @(Xp,yp,inparm)cv_log_malsar(Xp,yp,malsar_parm);
mcmtl_scorefn = @(Tmodel,Xdi,di)predict_malsar(Tmodel,Xdi,di);  

Generate predictions and print mean/stddev of cross-validated prediction accuracies for each task

acc_mcmtl = mcmtl_outparm.accT; % per-task accuracies
cvacc_mcmtl = mean(acc_mcmtl,1); % mean of accuracy across folds
cvstd_mcmtl = std(acc_mcmtl,0,1); % stddev of accuracy across folds
fprintf('T0: %0.4f (%0.4f) T1: %0.4f (%0.4f) T2: %0.4f (%0.4f)\n',...


When using this code, please use the following citations below.

  title        = {Adaptive Similarity Measures for Material Identification in Hyperspectral Imagery},
  author       = {Brian D. Bue},
  organization = {Rice University, Houston TX},
  address      = {\url{}}

  title        = {MultiClass MultiTask Learning (MCMTL) toolbox},
  author       = {Brian D. Bue},
  organization = {Rice University, Houston TX},
  address      = {\url{}},


Although this code has been reasonably well-tested, it is research code, and may contain bugs. Please feel free to contact the author ([email protected]) if you have any difficulties.


06/17/13 - initial release.


Please feel free to contact the author ([email protected]) if you have any questions or issues with the code described in this readme.

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.