size_cache=10;

printf("Load the data.\n");
traindata=load_matrix('./training.dat');
traindata=traindata';
trainlabels=load_matrix('./trainlabels_2484_2484.dat');
trainlabels=trainlabels';


testdata=load_matrix('./testing.dat');
testdata=testdata';
testlabels=load_matrix('./testlabels_752_17773.dat');
testlabels=testlabels';

printf("Train the SVM.\n")
C=1;
epsilon=1e-01;

width=2.1;
use_bias=false;

sg('set_kernel', 'GAUSSIAN', 'REAL', size_cache, width);
sg('set_features', 'TRAIN', traindata);
sg('set_labels', 'TRAIN', trainlabels);
sg('new_classifier', 'LIBSVM');
sg('svm_epsilon', epsilon);
sg('svm_use_bias', use_bias);
sg('c', C);
sg('train_classifier');

printf("Test the SVM.\n");
sg('set_features', 'TEST', testdata);
result=sg('classify');

S=sign(result);
exon=(sum(abs(S(753:end)+testlabels(753:end)))/2)/length(testlabels(753:end));
intron=(sum(abs(S(1:752)+testlabels(1:752)))/2)/length(testlabels(1:752));
printf("SVM Gaussian kernel for C/epsilon (%2.1f, %.0e):\t%3.2f%% Exon Accuracy\t%3.2f%% Intron Accuracy\n",C,epsilon,100*exon,100*intron);
