# a question on multiplicative SMV kernel

I'm new to SVM and would like to use it to solve a problem formulated, for example, as follows:

The patterns are four-dimensional vectors $(x_1,x_2,x_3,x_4)$, and the kernel is $K(\bf{x_i}, \bf{x_j})=k1([{x_i}_1, {x_i}_2], [{x_j}_1, {x_j}_2]) \times k2([{x_i}_3, {x_i}_4], [{x_j}_3, {x_j}_4)$

In other words, the kernel is the multiplication of two other kernels, each of which takes a pair of sub-patterns as input.

I came across libSVM and would like to know if the library is able to solve this kind of problem. Thanks.

-
Do you know what k1 and k2 are, and can you calculate them? If so, then no problem! Any svm library would work! – Stumpy Joe Pete Oct 19 '12 at 18:15
I plan to make k1 a Gaussian kernel and k2 a RBF kernel. According to its tutorial, it seems libSVM only allows you choose one kernel type out of linear, polynomial, rbf and sigmoid. How do I tell the library I want a multiplicative kernel? Please excuse me if this question is too basic, I just quickly went through a book on SVM yesterday – user11869 Oct 19 '12 at 18:22
The webpage mentioned that you can provide a precomputed kernel matrix. I have to go track down the documentation on how to do that, but the basic idea is to compute the kernel matrix yourself and to tell libsvm to use that – Stumpy Joe Pete Oct 19 '12 at 21:16

From the README file, on the topic of precomputed kernels:

Precomputed Kernels
===================

Users may precompute kernel values and input them as training and
testing files.  Then libsvm does not need the original
training/testing sets.

Assume there are L training instances x1, ..., xL and.
Let K(x, y) be the kernel
value of two instances x and y. The input formats
are:

New training instance for xi:

<label> 0:i 1:K(xi,x1) ... L:K(xi,xL)

New testing instance for any x:

<label> 0:? 1:K(x,x1) ... L:K(x,xL)

That is, in the training file the first column must be the "ID" of
xi. In testing, ? can be any value.

All kernel values including ZEROs must be explicitly provided.  Any
permutation or random subsets of the training/testing files are also
valid (see examples below).

Note: the format is slightly different from the precomputed kernel
package released in libsvmtools earlier.

Examples:

Assume the original training data has three four-feature
instances and testing data has one instance:

15  1:1 2:1 3:1 4:1
45      2:3     4:3
25          3:1

15  1:1     3:1

If the linear kernel is used, we have the following new
training/testing sets:

15  0:1 1:4 2:6  3:1
45  0:2 1:6 2:18 3:0
25  0:3 1:1 2:0  3:1

15  0:? 1:2 2:0  3:1

? can be any value.

Any subset of the above training file is also valid. For example,

25  0:3 1:1 2:0  3:1
45  0:2 1:6 2:18 3:0

implies that the kernel matrix is

[K(2,2) K(2,3)] = [18 0]
[K(3,2) K(3,3)] = [0  1]

-