Configuring svm with libsvm

I am new to using the LIBSVM package. I know that setting parameters is important, but I have a few questions.

How to choose the right core? I know that linear speed is faster, but when should we use another? Only if the accuracy is too low or is there some other way to program the automatic selection of the correct kernel?

Secondly, is there an efficient way to configure SVM in Matlab? The only thing I can think of is to make nested for -loops for each parameter that I want to test, and then train and predict using the classifier. This is a lot of code for something so basic ...

+4
source share
2 answers

How to choose the right core? I know that linear speed is faster, but when should we use another? Only if the accuracy is too low or is there some other way to program the automatic selection of the correct kernel?

The best approach is to always start with a linear core. If you are dealing with large data sets (hundreds of thousands of instances in thousands of dimensions), you probably want to use specialized linear packages (for example, LIBLINEAR ) or ensemble ( EnsembleSVM ). Note that the latter does not have proper matlab .

If you have widescreen sparse data, the linear core will usually work very well, even when compared to more complex kernels.

In general, if your accuracy with the linear core is not enough, the best option is to use the RBF core. As you know, they work very well on most data sets. You will need to configure the gamma kernel parameter if you switch to RBF kernels.

Secondly, is there an efficient way to configure SVM in Matlab?

Yes! LIBSVM provides cross-validation of k-fold using the -vk flag during training. When you provide this option, training will crosscheck the accuracy (classification) or mse (regression) instead of the model. However, you still have to iterate over the parameter tuples.

+2
source

Check out the link below. Good code snippets, especially showing parameter settings using cross-validation using three different scales. Hope this helps!

https://sites.google.com/site/kittipat/libsvm_matlab/demo_libsvm_crossvalidation

0
source

Source: https://habr.com/ru/post/1483371/


All Articles