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")
degree=3;
inhomogeneous=true;

use_normalization=true;
sg('set_kernel', 'POLY', 'REAL', size_cache, degree, inhomogeneous, use_normalization);
sg('set_features', 'TRAIN', traindata);
sg('set_labels', 'TRAIN', trainlabels);
sg('new_classifier', 'LIBSVM');
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 Polynomial kernel for degree/inhomogeneous (%d, %d):\t%3.2f%% Exon Accuracy\t%3.2f%% Intron Accuracy\n",degree,inhomogeneous,100*exon,100*intron);
