OpenKernel Quick Tour
Under construction.
Using the library
In this quick tour, we will focus on the command-line utilities and libsvm plugin.
The command-line utilities are available in the
bin
sub-directory.
Creating an n-gram kernel
The
klngram
utility can be used to generate an n-gram kernel. The
-order
option
specifies the n-gram order and the
-sigma
option the size of the alphabet (
i.e.
the maximum label id). The output of
klngram
is a
kar
file (for kernel archive)
that contains both the kernel and the data it is defined on.
$ klngram -order=3 -sigma=2 fst.list > 3-gram.kar
In addition to n-gram kernels, the library provides tools for the creation of gappy n-gram kernels,
mismatch kernels and arbitrary rational kernels.
Generating a kernel matrix
$ kleval 3-gram.kar > 3-gram.matrix
Using the LIBSVM plugin
The OpenKernel library package includes a modified version of
LIBSVM that allows the definition
of arbitrary plugins to handle the kernel computations. This version of LIBSVM is available
in the
libsvm
sub-directory. A specific plugin to allow the use of the OpenKernel library
with libsvm is provided in the
plugin
sub-directory. In order to use this plugin, you
need to add the path to the
plugin
sub-directory to your dynamic loader path (
LD_LIBRARY_PATH
on Linux,
DYLD_LIBRARY_PATH
on
MacOS X).
$ svm-train -k kernellib -K 3-gram.kar train 3-gram.model
$ svm-predict test 3-gram.model 3-gram.pred
--
CyrilAllauzen - 08 Oct 2007