Search code examples
image-processingcomputer-visionsvmlibsvmpattern-recognition

libsvm liblinear how to use histogram intersection/chi square kernels


Is it possible to use histogram intersection /chi sauare kernels in LIBLINEAR?

My problem is I have a feature vector of size 5000 all are histogram features. I dont know how to train/ test with SVM.

How can I train this using SVM?

libSVM supports for 4 types of kernels.

    0 -- linear: u'*v
1 -- polynomial: (gamma*u'*v + coef0)^degree
2 -- radial basis function: exp(-gamma*|u-v|^2)
3 -- sigmoid: tanh(gamma*u'*v + coef0)

LibSVM supports for linear kernel in that case what is the difference between libSVM and linearSVM?


Solution

  • No, you can't use custom kernels in liblinear.

    To do what you want to do, you'll need to use LibSVM and the "precomputed kernel" option, where you supply the gram matrix (this is described in the LibSVM README).

    In the case of linear kernels, LibSVM and LibLinear produce similar results. The author says this:

    Their predictions are similar but hyperplanes are different. Libsvm solves L1-loss SVM, but liblinear solves L2-regularized logistic regression and L2-loss SVM.