TWiki> Kernel Web>KernelQuickTour (revision 2)EditAttach

OpenKernel Quick Tour

Warning, important 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 LIBSVMExternal site 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

Edit | Attach | Watch | Print version | History: r11 | r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r2 - 2007-10-09 - CyrilAllauzen
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback