An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090504/0cd11104/attachment-0001.pl>
Caret package: coeffcients for regression
2 messages · Alex Roy, Max Kuhn
Alex,
I am using "Caret"package for SVM regression and elastic net regression . I can get the final fiited vs observed values. How can I get the coefficients? Any ideas?
You didn't say what version of caret and R you are using, what kernel or what type of coefficients. If you tune a model using train: fit <- train(x, y, "enet") then fit$finalModel contains an enet object with the final parameters. You can use coef() or any other appropriate function on this object. In the case of the elastic net, see ?predict.enet, specifically the type argument to get the regression coefficients. If you need to get to the final tuning parameters for the model, you can access them via x$finalModel$tuneValue. There are a few exceptions to this: models using S4 classes won't allow adding new objects. For SVMs, you haven't said what kernel type you used. caret uses kernel methods from kernlab (for no other reason that I like the package). The only package that I know gives the *regression* coefficients for linear kernels is svmpath (there could be others). If you want the SV coefficients (typically denoted by alpha), kernlab has a slot called coef that you can use. You should really provide more information for your questions to be answered well.
Max