[R] Error using e1071 svm: NA/NaN/Inf in foreign function call
Achim Zeileis
Achim.Zeileis at wu-wien.ac.at
Wed Apr 27 14:50:39 CEST 2005
On Wed, 27 Apr 2005 10:25:55 +0100 João Mendes Moreira wrote:
> My mistake.
>
> I am sending the ImageBeforeError.RData file.
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.
> To reproduce the error you must load the file and then to do:
>
> library("e1071")
> model <- do.call(learner,learner.pars)
>
> I am using nu = 0.7. At this moment I do not get an error but the svm
> function blocks. It was al that night running without results.
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
> Using
> other kernels it used to finish in a few seconds. I have done already
> thousands of tests with other kernels. Only with the polynomial one I
> am not able to get results.
>
> Thanks for any help.
>
> Joao
> ----- Original Message -----
> From: "Achim Zeileis" <Achim.Zeileis at wu-wien.ac.at>
> To: "João Mendes Moreira" <jmoreira at fe.up.pt>
> Cc: <r-help at stat.math.ethz.ch>
> Sent: Tuesday, April 26, 2005 4:09 PM
> Subject: Re: [R] Error using e1071 svm: NA/NaN/Inf in foreign function
> call
>
>
> > On Tue, 26 Apr 2005 15:46:20 +0100 João Mendes Moreira wrote:
> >
> >> Hello,
> >>
> >> As far I saw in archive mailing list, I am not the first person
> >with> this problem. Anyway I was not able to pass this error once the
> >> information I got from the archive it is not very conclusive for
> >this> case. I have used linear, radial and sigmoid kernels for the
> >same data> in the same conditions and everything is ok. This problem
> >just> happens with the polynomial kernel. I send the debuging result
> >from a> reproducible example. The error message is at the end.
> >
> > I receive a different error message:
> > Error in eval(expr, envir, enclos) : Object "Fim" not found
> > So much for the reproducibility... Wouldn't it be possible to simply
> > use a data set that is already available in R, *please*?
> >
> > Anyways, it seems that your specification of `nu' causes the
> > problem: 0 might be a little bit too small.
> > Z
> >
> >
>
More information about the R-help
mailing list