Hi all,
I’m working on building predictive classifiers in R on cancer dataset. I’m using random forest, support vector machine and navies Bayes classifiers. I’m unable to calculate variable importance on SVM and NB models
I end up receiving the subsequent error.
Error in UseMethod("varImp") :
no applicable method for 'varImp' applied to an object of class "c('svm.formula', 'svm')"
I would greatly appreciate it if anyone could help me.
Thanks in advance.
1 answer
It looks like you're using the caret package which has no implementation of varImp for SVM. As far as I know, caret can give variable importance only for algorithms that can do feature selection and the standard 2-norm SVM is not one of them. The only package that I know does feature selection for SVM is the package penalizedSVM. With the 1-norm SVM, the weights reflect the importance of the features.
Log in to answer this question.