PRTools Contents

PRTools User Guide

libsvc

LIBSVC

Trainable classifier: LIBSVM

    [W,J] = LIBSVC(A,KERNEL,C)
    [W,J] = A*LIBSVC([],KERNEL,C)
    [W,J] = A*LIBSVC(KERNEL,C)

Input
 A Dataset
 KERNEL Mapping to compute kernel by A*MAP(A,KERNEL) or string to compute kernel by FEVAL(KERNEL,A,A) or cell array with strings and parameters to compute kernel by
 FEVAL(KERNEL{1},A,A,KERNEL{2:END})   Default: linear kernel (PROXM([],'P',1))
 C Trade_off parameter in the support vector classifier.  Default C = 1;

Output
 W Mapping: Support Vector Classifier
 J Object idences of support objects. Can be also obtained as W{4}

Description

Optimises a support vector classifier for the dataset A by the libsvm  package, see http://www.csie.ntu.edu.tw/~cjlin/libsvm/. LIBSVC calls the  svmtrain routine of libsvm for training. Classifier execution for a  test dataset B may be done by D = B*W; In D posterior probabilities are  given as computed by svmpredict using the '-b 1' option.

The kernel may be supplied in KERNEL by

  • an untrained mapping, e.g. a call to PROXM like W = LIBSVC(A,PROXM([],'R',1))
  • a string with the name of the routine to compute the kernel from A
  • a cell-array with this name and additional parameters.  This will be used for the evaluation of a dataset B by B*W or PRMAP(B,W) as  well.

If KERNEL = 0 (or not given) it is assumed that A is already the  kernelmatrix (square). In this also a kernel matrix should be supplied at  evaluation by B*W or PRMAP(B,W). However, the kernel has to be computed with  respect to support objects listed in J (the order of objects in J does matter).

The LIBSVM package can be found on several places on the internet, e.g.  here and here.

Example(s)

 a = gendatb;                     % generate banana classes
 [w,J] = a*libsvc(proxm('p',3));  % compute svm with 3rd order polynomial
 a*w*testc                        % show error on train set
 scatterd(a)                      % show scatterplot
 plotc(w)                         % plot classifier
 hold on; 
 scatterd(a(J,:),'o')             % show support objcts

Reference(s)

R.-E. Fan, P.-H. Chen, and C.-J. Lin. Working set selection using the second order information for training SVM. Journal of Machine Learning Research 6, 1889-1918, 2005

See also

mappings, datasets, svc, proxm,

PRTools Contents

PRTools User Guide

This file has been automatically generated. If badly readable, use the help-command in Matlab.