3
$\begingroup$

I'm using kernlab package in R. I trained an SVM using linear kernel and RBF kernel with same data set (the number of instances is 3000). When I use a linear kernel, it takes much longer to train the model compared to when I use an RBF kernel (accuracies are similar). Why does this run-time difference exist?

$\endgroup$

1 Answer 1

2
$\begingroup$

Time difference arises from various sources with SVMs.

First, you need to compute the kernel matrix (i.e. the matrix populated with $K(x_i,x_j)$). Normally, this should take longer for the RBF kernel than for the linear kernel (the linear kernel does not have to call $\exp$ which is the most expansive part).

However, the time of the training part is also a significant part of the training process which consists of solving the quadratic program is variable in $C$ the cost parameters and the kernel matrix of the training samples.

The difference in total training time that you is likely due to the fact that the kernel matrices that you obtain from RBF and linear kernel are different and the optimization problem with the latter one happens to be a much harder problem in this case.

$\endgroup$
1
  • $\begingroup$ Good answer (+1), I also made some changes to your answer to make it more clear. Please feel free to modify. $\endgroup$
    – Sobi
    Commented Dec 9, 2015 at 18:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.