Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|

## OpenKernel Quick Tour | ||||||||

Line: 18 to 18 | ||||||||

by the OpenFst library. The OpenFst quick tour contains the relevant information for accomplishing this. | ||||||||

Changed: | ||||||||

< < | A dataset is then represented by a Fst archive (`far` file) or by a text file containing a list of `fst` file (specified using an | |||||||

> > | A dataset is then represented by a Fst archive (`far` file) or by a text file containing a list of `fst` file (specified using an | |||||||

absolute path). The i -th entry in the `far` archive or in the `fst` list being the `fst` representing the i -th point
in the dataset. | ||||||||

Line: 41 to 41 | ||||||||

Changed: | ||||||||

< < | In addition to n-gram kernels, the library provides tools for the creation of gappy n-gram kernels, mismatch kernels and arbitrary rational kernels. | |||||||

> > | In addition to n-gram kernels, the library provides tools for the creation of gappy n-gram kernels (`klngram` ),
mismatch kernels (`klmismatch` ) and arbitrary rational kernels (`klrational` ). | |||||||

Kernels can also be combined by taking their sum (`klsum` ) or product (`klproduct` ) or
can be composed with a polynomial (`klpolynomial` ), a gaussian (`klgaussian` ) or |

Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|

## OpenKernel Quick Tour | ||||||||

Line: 18 to 18 | ||||||||

by the OpenFst library. The OpenFst quick tour contains the relevant information for accomplishing this. | ||||||||

Changed: | ||||||||

< < | A dataset is then represented by a text file containing a list of `fst` file (specified using an
absolute path). The i -th file in the list being the `fst` representing the i -th point | |||||||

> > | A dataset is then represented by a Fst archive (`far` file) or by a text file containing a list of `fst` file (specified using an
absolute path). The i -th entry in the `far` archive or in the `fst` list being the `fst` representing the i -th point | |||||||

in the dataset.
This dataset should contain both your training and testing data. | ||||||||

Line: 37 to 37 | ||||||||

that contains both the kernel function and the dataset it is defined on. | ||||||||

Changed: | ||||||||

< < | $ klngram -order=3 -sigma=2 fst.list > 3-gram.kar | |||||||

> > | $ klngram -order=3 -sigma=2 data.far > 3-gram.kar | |||||||

Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|

## OpenKernel Quick Tour | ||||||||

Line: 24 to 24 | ||||||||

This dataset should contain both your training and testing data. | ||||||||

Changed: | ||||||||

< < | An example of dataset, a subset of Reuters-21578, is provided with the library | |||||||

> > | An example of dataset, a subset of Reuters-21578, is provided with the library | |||||||

and can be used to become familiar with its usage. |

Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|

## OpenKernel Quick Tour | ||||||||

Line: 34 to 34 | ||||||||

specifies the n-gram order and the `-sigma` option the size of the alphabet (i.e.
the maximum label id). The `fst.list` specifies the dataset the kernel is operating
on. The output of `klngram` is a `kar` file (for kernel archive) | ||||||||

Changed: | ||||||||

< < | that contains both the kernel and the data it is defined on. | |||||||

> > | that contains both the kernel function and the dataset it is defined on. | |||||||

$ klngram -order=3 -sigma=2 fst.list > 3-gram.kar | ||||||||

Line: 62 to 62 | ||||||||

n floats on each line. The j -th value on the i -th line correspond to the value
of the kernel for the i -th and j -th points in the dataset. | ||||||||

Added: | ||||||||

> > | The kernel matrix can be partially computed by restricting the
set of values to be evaluated using the `-xmin` , `-xmax` , `-ymin` and `-ymax`
flags. Assuming the lines and columns are indexed from 0 to n - 1, the following
command can be used to only compute the (i, j) value if and only if 10 ≤ i, j < 20:
kleval -xmin=10 -ymin=10 -xmax=20 -ymax=20 3-gram.kar | |||||||

Using the `-libsvm` option will generate a file in the format used by LIBSVM to specify
precomputed kernels. LIBSVM users are however encouraged to use the LIBSVM plugin
as described below. | ||||||||

Added: | ||||||||

> > | Finally, the `-kar` option allows the kernel matrix to be stored in a kar file in addition to
the kernel function and dataset.
$ kleval 3-gram.kar > 3-gram.matrix.kar | |||||||

## Using the LIBSVM plugin | ||||||||

Line: 112 to 128 | ||||||||

$ svm-predict test 3-gram.model 3-gram.pred | ||||||||

Added: | ||||||||

> > | When using the LIBSVM plugin, the kernel values are computed "on the fly" as requested by the LIBSVM utilities.
When performing several experiments using the same kernel (on the same dataset), it is recommended, in order to
avoid unnecessary computations, to
first compute the (partial) kernel matrix using `kleval -kar` and use the resulting `kar` file as a parameter
to the LIBSVM utilities. | |||||||

-- CyrilAllauzen - 08 Oct 2007 \ No newline at end of file |

Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|

## OpenKernel Quick Tour | ||||||||

Line: 98 to 98 | ||||||||

The `svm-train` utility needs to be call with two additional options. The `-k` option
specifies the type of kernel and should be `openkernel` when using the OpenKernel library.
The `-K` option specifies the `kar` file defining the kernel and dataset to be used. | ||||||||

Added: | ||||||||

> > | All the other `svm-train` options are still available. | |||||||

For example: |

Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|

## OpenKernel Quick Tour | ||||||||

Line: 24 to 24 | ||||||||

This dataset should contain both your training and testing data. | ||||||||

Added: | ||||||||

> > | An example of dataset, a subset of Reuters-21578, is provided with the library and can be used to become familiar with its usage. | |||||||

## Creating an | ||||||||

Line: 93 to 96 | ||||||||

will only be used for scoring).
The | ||||||||

Changed: | ||||||||

< < | specifies the type of kernel and should be `kernellib` when using the OpenKernel library. | |||||||

> > | specifies the type of kernel and should be `openkernel` when using the OpenKernel library. | |||||||

The `-K` option specifies the `kar` file defining the kernel and dataset to be used.
For example: | ||||||||

Changed: | ||||||||

< < | $ svm-train -k kernellib -K 3-gram.kar train 3-gram.model | |||||||

> > | $ svm-train -k openkernel -K 3-gram.kar train 3-gram.model | |||||||

The |

Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|

## OpenKernel Quick Tour
| ||||||||

Added: | ||||||||

> > | ||||||||

## Using the library | ||||||||

Changed: | ||||||||

< < | 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. | |||||||

> > | In this quick tour, we will focus on the command-line utilities and LIBSVM plugin.
The command-line utilities are available in the `kernel/bin` sub-directory. | |||||||

Changed: | ||||||||

< < | ## Creating an n-gram kernel | |||||||

> > |
## Preparing your data
In order to use the library, you need to represent each point in your dataset as an
A dataset is then represented by a text file containing a list of This dataset should contain both your training and testing data. ## Creating an | |||||||

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. | ||||||||

Changed: | ||||||||

< < | the maximum label id). The output of `klngram` is a `kar` file (for kernel archive) | |||||||

> > | the maximum label id). The `fst.list` specifies the dataset the kernel is operating
on. The output of `klngram` is a `kar` file (for kernel archive) | |||||||

that contains both the kernel and the data it is defined on. | ||||||||

Line: 24 to 41 | ||||||||

In addition to n-gram kernels, the library provides tools for the creation of gappy n-gram kernels, mismatch kernels and arbitrary rational kernels. | ||||||||

Changed: | ||||||||

< < | ## Generating a kernel matrix | |||||||

> > | Kernels can also be combined by taking their sum (`klsum` ) or product (`klproduct` ) or
can be composed with a polynomial (`klpolynomial` ), a gaussian (`klgaussian` ) or
a sigmoid (`klsigmoid` ). | |||||||

Added: | ||||||||

> > |
## Generating a kernel matrix | |||||||

Added: | ||||||||

> > | The kernel matrix corresponding to the evaluation of the kernel on the specified dataset
can be computed using the `kleval` utility as shown here: | |||||||

$ kleval 3-gram.kar > 3-gram.matrix | ||||||||

Added: | ||||||||

> > | Assuming the size of the dataset is n, the result will be a text file with n lines and
n floats on each line. The j -th value on the i -th line correspond to the value
of the kernel for the i -th and j -th points in the dataset.
Using the | |||||||

Added: | ||||||||

> > | ||||||||

## 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 | ||||||||

Changed: | ||||||||

< < | 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` | |||||||

> > | with libsvm is provided in the `kernel/plugin` sub-directory. In order to use this plugin, you
need to add the path to the `kernel/plugin` sub-directory to your dynamic loader path (`LD_LIBRARY_PATH` | |||||||

on Linux, `DYLD_LIBRARY_PATH` on MacOS X). | ||||||||

Added: | ||||||||

> > | The training and test dataset need to be specified in the usual LIBSVM format (if you are not familiar with
LIBSVM check out the official website or
the `README` file in the `libsvm` directory).
For instance a text file `train` such as:
1 1:1.0 -1 2:1.0 1 4:1.0specifies that the 1st, 2nd and 4th points of the dataset are in the training set with labels 1, -1 and 1. And a text file `test` such as:
-1 3:1.0 1 5:1.0specifies that the 3rd and 5th points of the dataset are in the test set (the labels are optional here and will only be used for scoring). | |||||||

Changed: | ||||||||

< < | ||||||||

> > | The `svm-train` utility needs to be call with two additional options. The `-k` option
specifies the type of kernel and should be `kernellib` when using the OpenKernel library.
The `-K` option specifies the `kar` file defining the kernel and dataset to be used.
For example: | |||||||

$ svm-train -k kernellib -K 3-gram.kar train 3-gram.model | ||||||||

Deleted: | ||||||||

< < | $ svm-predict test 3-gram.model 3-gram.pred | |||||||

Added: | ||||||||

> > | The `svm-predict` utility does not required any additional options. The kernel information
is included in the `model` file:
$ svm-predict test 3-gram.model 3-gram.pred | |||||||

Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|

## OpenKernel Quick Tour | ||||||||

Changed: | ||||||||

< < | .Under construction | |||||||

> > | .Under construction | |||||||

## Using the library | ||||||||

Line: 36 to 36 | ||||||||

## Using the LIBSVM pluginThe OpenKernel library package includes a modified version of | ||||||||

Changed: | ||||||||

< < | LIBSVM that allows the definition | |||||||

> > | 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` | ||||||||

Changed: | ||||||||

< < | on Linux, `DYLD_LIBRARY_PATH` on MacOS X). | |||||||

> > | on Linux, `DYLD_LIBRARY_PATH` on MacOS X). | |||||||

Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|

## OpenKernel Quick Tour | ||||||||

Line: 11 to 11 | ||||||||

## Creating an n-gram kernel | ||||||||

Added: | ||||||||

> > | 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 | ||||||||

Line: 26 to 33 | ||||||||

Changed: | ||||||||

< < | ## Using the libsvm plugin | |||||||

> > | ## Using the LIBSVM plugin | |||||||

Changed: | ||||||||

< < | 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 | |||||||

> > | 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 | ||||||||

Changed: | ||||||||

< < | with libsvm is provided in the `plugin` sub-directory. | |||||||

> > | 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). | |||||||

Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|

Added: | ||||||||

> > |
## OpenKernel Quick Tour
## 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
## Creating an n-gram kernel
$ 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
$ 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 |

View topic | History: r11 < r10 < r9 < r8 | More topic actions...

Copyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.

Ideas, requests, problems regarding TWiki? Send feedback

Ideas, requests, problems regarding TWiki? Send feedback