Hi Uwe,
It looks SVM in e1071 and Kernlab does not support feature selection, but
you can take a look at package penalizedSVM (
http://cran.r-project.org/web/packages/penalizedSVM/penalizedSVM.pdf).
Or you can implement a SVM-RFE (
http://axon.cs.byu.edu/Dan/778/papers/Feature%20Selection/guyon*.pdf) by
the alpha values returned by svm() in e1071 or ksvm() in Kernlab.
Wuming
On Fri, Dec 6, 2013 at 7:06 AM, Uwe Bohne <balu555@gmx.de> wrote:
>
> Hej all,
>
> actually i try to tune a SVM in R and use the package "e1071"
wich works
> pretty well.
> I do some gridsearch in the parameters and get the best possible
> parameters
> for classification.
> Here is my sample code
>
> type<-sample(c(-1,1) , 20, replace = TRUE )
> weight<-sample(c(20:50),20, replace=TRUE)
> height<-sample(c(100:200),20, replace=TRUE)
> width<-sample(c(30:50),20,replace=TRUE)
> volume<-sample(c(1000:5000),20,replace=TRUE)
>
> data<-cbind(type,weight,height,width,volume)
> train<-as.data.frame(data)
> library("e1071")
>
> features <-
c("weight","height","width","volume")
> (formula<-as.formula(paste("type ~ ", paste(features,
collapse= "+"))))
>
> svmtune=tune.svm(formula, data=train, kernel="radial",
cost=2^(-2:5),
> gamma=2^(-2:1),cross=10)
> summary(svmtune)
>
> My question is if there is a way to tune the features.
>
> So in other words - what i wanna do is to try all possible combinations
> of
> features : for example use only (volume) or use (weight, height) or use
> (height,volume,width) and so on for the SVM and to get the best
> combination
> back.
>
>
> Best wishes
>
> Uwe
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]