Precomputed Kernels with LibSVM in Python
Posted
by Lyyli
on Stack Overflow
See other posts from Stack Overflow
or by Lyyli
Published on 2010-03-19T01:32:12Z
Indexed on
2010/03/19
1:41 UTC
Read the original article
Hit count: 519
I've been searching the net for ~3 hours but I couldn't find a solution yet. I want to give a precomputed kernel to libsvm and classify a dataset, but:
How can I generate a precomputed kernel? (for example, what is the basic precomputed kernel for Iris data?)
In the libsvm documentation, it is stated that:
For precomputed kernels, the first element of each instance must be the ID. For example,
samples = [[1, 0, 0, 0, 0], [2, 0, 1, 0, 1], [3, 0, 0, 1, 1], [4, 0, 1, 1, 2]] problem = svm_problem(labels, samples) param = svm_parameter(kernel_type=PRECOMPUTED)
What is a ID? There's no further details on that. Can I assign ID's sequentially?
Any libsvm help and an example of precomputed kernels really appreciated.
© Stack Overflow or respective owner