function predicted=cosmo_classify_libsvm(samples_train, targets_train, samples_test, opt)
% libsvm-based SVM classifier
%
% predicted=cosmo_classify_libsvm(samples_train, targets_train, samples_test, opt)
%
% Inputs
% samples_train PxR training data for P samples and R features
% targets_train Px1 training data classes
% samples_test QxR test data
% opt (optional) struct with options for svmtrain
% .autoscale If true (default), z-scoring is done on the training
% set; the test set is z-scored using the mean and std
% estimates from the training set.
% ? any option supported by libsvm's svmtrain.
%
% Output
% predicted Qx1 predicted data classes for samples_test
%
% Notes:
% - this function requires libsvm version 3.18 or later:
% https://github.com/cjlin1/libsvm
% - by default a linear kernel is used ('-t 0')
% - this function uses LIBSVM's svmtrain function, which has the same
% name as matlab's builtin version. Use of this function is not
% supported when matlab's svmtrain precedes in the matlab path; in
% that case, adjust the path or use cosmo_classify_matlabsvm instead.
% - for a guide on svm classification, see
% http://www.csie.ntu.edu.tw/~cjlin/papers/guide/guide.pdf
% - By default this function performs z-scoring of the data. To switch
% this off, set 'autoscale' to false
% - cosmo_crossvalidate and cosmo_crossvalidation_measure
% provide an option 'normalization' to perform data scaling
%
%
% See also svmtrain, svmclassify, cosmo_classify_svm,
% cosmo_classify_matlabsvm
%
% # For CoSMoMVPA's copyright information and license terms, #
% # see the COPYING file distributed with CoSMoMVPA. #