Skip to content

Error using e1071 svm: NA/NaN/Inf in foreign function call

1 message · Achim Zeileis

#
On Wed, 27 Apr 2005 10:25:55 +0100 Jo??o Mendes Moreira wrote:

            
No, no, no! Please the read the posting guide and please read the
answers that were posted for you. As you obviously did not do that, let
me read it to you again:
  <Z>
  Wouldn't it be possible to simply use a data set that is already
  available in R, *please*?
  </Z>
The solution is definitely not to send a huge data file (6.5M) to
those who offered advice and to the subsribers of R-help (where it does
not get through anyway, I think). If it is really data-dependent, then
you might post the data on the web, but even then it is not very helpful
to post a file in which there are dozens of objects when all you need is
a data frame.
So there is no error as you claim above (and as you claimed in your
previous mail). This is just to report the fact, that your computations
are still running.

Let me provide a simple reproducible example which does not involve
spamming R-helpers with .RData files.
You seem to want to report that the svm

set.seed(1071)
y <- rnorm(100)
x1 <- rnorm(100)
x2 <- rnorm(100)
svm(y ~ x1 + x2)

can be fitted very quickly whereas

svm(y ~ x1 + x2, cost = 4096, kernel = "polynomial", degree = 4)

takes much longer. The decisive parameter here is the cost parameter
which is unusually large. I'm not sure why the algorithm gets so slow,
but you might also want to check whether a cost parameter of the
magnitude is appropriate. The other parameter which is important is the
degree of the polynomial kernel, in which the complexity is also
increasing.

So the message is: Be careful in the selection of the hyperparameters of
the SVM. Maybe someone else on the list can provide more insight on
guidelines for choosing the hyperparameters of a polynomial kernel SVM.
Z