% In this example a kernel matrix is computed for a given string data set. The
% CommUlongString kernel is used to compute the spectrum kernel from strings that
% have been mapped into unsigned 64bit integers. These 64bit integers correspond
% to k-mers. To be applicable in this kernel the mapped k-mers have to be sorted.
% This is done using the SortUlongString preprocessor, which sorts the indivual
% strings in ascending order. The kernel function basically uses the algorithm in
% the unix "comm" command (hence the name). Note that this representation enables
% spectrum kernels of order 8 for 8bit alphabets (like binaries) and order 32 for
% 2-bit alphabets like DNA. For this kernel the linadd speedups are implemented
% (though there is room for improvement here when a whole set of sequences is
% ADDed) using sorted lists.

% SortUlongString
print CommUlongString
add_preproc SORTULONGSTRING
set_kernel COMMSTRING ULONG 10 0 FULL

set_features TRAIN ../data/fm_train_dna.dat DNA
convert TRAIN STRING CHAR STRING ULONG 3 2 0 n
attach_preproc TRAIN
km_train.txt = get_kernel_matrix TRAIN

set_features TEST ../data/fm_test_dna.dat DNA
convert TEST STRING CHAR STRING ULONG 3 2 0 n
attach_preproc TEST
km_test.txt = get_kernel_matrix TEST
