% SVM_EXP1 Example on training SVM and using SVM classifier
%

% Modifications:
% 24-aug-2004, VF

% load training and testing data
trn_data = load('riply_trn');
tst_data = load('riply_tst');

% set up SVM paramaters
options.ker = 'rbf';     % kernel
options.arg = 1;         % kernel argument
options.C = 10;          % regularization constant

% training SVM model
svm_model = svmlight(trn_data,options);
%svm_model = smo(trn_data,options);

% error
ypred = svmclass(trn_data.X, svm_model);
trnerr = cerror(ypred, trn_data.y)

ypred = svmclass(tst_data.X, svm_model);
tsterr = cerror(ypred, tst_data.y)

% plot decision boundy (works only for 2D data)
figure; 
ppatterns(trn_data); 
psvm(svm_model);

%EOF

