I recently got this puzzling error from the kernlab package, in a script that used to work really nice before:
Error in laplacedot(length = 4, lambda = 0.5) : unused arguments (length = 4, lambda = 0.5)
Switching method didn’t help, for instance with a radial basis kernel instead of the laplacian one:
Error in rbfdot(length = 4, lambda = 0.5) : unused arguments (length = 4, lambda = 0.5)
Apparently someone asked that on Inside-R and Stackoverflow, but didn’t care to share their solution beyond “I figured out that it’s all because of the format xtrain and ytrain”.
Well I eventually figured that out too, it turns out xtrain must be a matrix, so the fix is as simple as changing this:
svm.kernlab.mdl = ksvm(Xtrain, as.factor(ytrain),kernel="laplacedot");
into this:
svm.kernlab.mdl = ksvm(as.matrix(Xtrain), as.factor(ytrain),kernel="laplacedot");
Of course, package maintainers could do the conversion themselves, or at least provide meaningful error messages…
I use this code in a classifier wrapper in R package mc-r, currently under development and accessible at Google Code and Bitbucket:
https://code.google.com/p/mc-r/
https://bitbucket.org/patheticcockroach/mc-r/src
Thanks, It worked for me
Great! Thanks, it helped me as well
Thanks for this
Thank you Thank you Thank you!!! I was reading through the other post that you mentioned and found it unhelpful because of the lack of explanation at the end. Your post here was a life-saver!
Thanks that was really helpful.