EVALSVM

Trains and evaluates Support Vector Machines classifier.



 Synopsis:
  [model,Errors] = evalsvm(data,options)
  [model,Errors] = evalsvm(trn_data,val_data,options)

 Description:
  [model,Errors] = evalsvm(data,options) uses cross-validation
    to assess SVM classifiers with given kernel arguments and 
    regularization constants.
   
    The kernel type is given in options.ker (see 'help kernel').
    The SVM solver to be used is specified by field options.solver 
    (default 'smo'). Both binary and multi-class SVM solvers are 
    allowed. The input data have the following format:
    be used with regards to the number of labels of training data 
      data.X [dim x num_data] ... training vectors.
      data.y [1 x num_data] ... labels.
    The set of SVM parameters to be evaluated are specified in:
      options.arg [dimarg x nargs] ... enumeration of  kernel arguments; 
        dimarg determins number of kernel argumens (e.g., dimarg = 1 
        for 'rbf' kernel and dimarg = 2 for 'sigmoid').
      options.C [1 x nc] ... enumeration of regularization constants.

    Some extra parameters for the selected SVM solver can be
    specified in the field options.solver_options.

    Each configuration of SVM paramaters is evaluated using the
    cross-validation. The number of folds is given in 
    optios.num_folds (default 5). The trained SVM model with 
    the smallest cross-validation error is returned. The computed
    cross-validation errors with respect to SVM parametes are 
    returned in Errors [nc x nargs].

    The progress info is displayed if options.verb is set to 1
    (default 0).

  [model,Errors] = evalsvm(trn_data,val_data,options) each
    SVM is trained on the trn_data and evaluated on the 
    validation val_data instead of using cross-validation.
   
 Example:
  trn = load('riply_trn');
  tst = load('riply_tst');
  options.ker = 'rbf';
  options.arg = [0.1 0.5 1 5];
  options.C = [1 10 100];
  options.solver = 'smo';
  options.num_folds = 5;
  options.verb = 1;
  [model,Errors] = evalsvm(trn,options);
  figure; mesh(options.arg,options.C,Errors);
  hold on; xlabel('arg'); ylabel('C');
  ypred = svmclass(tst.X,model);
  cerror(ypred,tst.y)

 See also: 
   SMO, SVMLIGHT, SVMCLASS.


Source: evalsvm.m

Modifications:
17-sep-2004, VF, Help improved. Info about training stage added.
18-aug-2004, VF, svm_options changed to solver_options
4-june-2004, VF
3-jun-2004, VF