


Relevance vector regression (training and testing)
FORMAT output = prt_machine_svm_bin(d,args)
Inputs:
d - structure with data information, with mandatory fields:
.train - training data (cell array of matrices of row vectors,
each [Ntr x D]). each matrix contains one representation
of the data. This is useful for approaches such as
multiple kernel learning.
.test - testing data (cell array of matrices row vectors, each
[Nte x D])
.tr_targets - training labels (for classification) or values (for
regression) (column vector, [Ntr x 1])
.use_kernel - flag, is data in form of kernel matrices (true) of in
form of features (false)
args - libSVM arguments
Output:
output - output of machine (struct).
* Mandatory fields:
.predictions - predictions of classification or regression [Nte x D]
* Optional fields:
.func_val - value of the decision function
.type - which type of machine this is (here, 'classifier')
__________________________________________________________________________
Copyright (C) 2011 Machine Learning & Neuroimaging Laboratory

0001 function output = prt_machine_rvr(d,args) 0002 % Relevance vector regression (training and testing) 0003 % FORMAT output = prt_machine_svm_bin(d,args) 0004 % Inputs: 0005 % d - structure with data information, with mandatory fields: 0006 % .train - training data (cell array of matrices of row vectors, 0007 % each [Ntr x D]). each matrix contains one representation 0008 % of the data. This is useful for approaches such as 0009 % multiple kernel learning. 0010 % .test - testing data (cell array of matrices row vectors, each 0011 % [Nte x D]) 0012 % .tr_targets - training labels (for classification) or values (for 0013 % regression) (column vector, [Ntr x 1]) 0014 % .use_kernel - flag, is data in form of kernel matrices (true) of in 0015 % form of features (false) 0016 % args - libSVM arguments 0017 % Output: 0018 % output - output of machine (struct). 0019 % * Mandatory fields: 0020 % .predictions - predictions of classification or regression [Nte x D] 0021 % * Optional fields: 0022 % .func_val - value of the decision function 0023 % .type - which type of machine this is (here, 'classifier') 0024 %__________________________________________________________________________ 0025 % Copyright (C) 2011 Machine Learning & Neuroimaging Laboratory 0026 0027 % Written by Carlton Chu 0028 % $Id: prt_machine_rvr.m 370 2011-11-12 15:30:53Z cphillip $ 0029 0030 0031 output.type=d.pred_type; 0032 0033 SANITYCHECK=true; % can turn off for "speed". Expert only. 0034 0035 if SANITYCHECK==true 0036 % args should be a string (empty or otherwise) 0037 0038 K=d.train{1}; 0039 [n m]=size(K); 0040 if n~=m 0041 error('prt_machine_krr:kernelSize',['Error: krr'... 0042 ' training kernel should be square ' ... 0043 ' SOLUTION: do the right thing']); 0044 end 0045 0046 % Run RVR 0047 %-------------------------------------------------------------------------- 0048 t=d.tr_targets; 0049 w=prt_rvr(K,t); 0050 0051 output.predictions=d.test{1}*w(1:end-1)+w(end); 0052 output.func_val=output.predictions; 0053 output.alpha=w(1:end-1); 0054 0055 end 0056 0057 end