Reza Salimi-Khorshidi
2012-Mar-31 13:55 UTC
[R] How can I extract the weights (for feature selection) from linear KSVM?
Hello all, I need some help with extracting the feature-wise weights from the SVM object that is the output of *ksvm* function in R (from *kernlab* package). For instance, if I use the same data/example as the help page does, i.e., data(spam) index <- sample(1:dim(spam)[1]) spam.train <- spam[index[1:floor(2*dim(spam)[1]/3)],] spam.test <- spam[index[((2*ceiling(dim(spam)[1]/3))+1):dim(spam)[1]],] filter <- ksvm(type ~ ., data = spam.train, kernel = "vanilladot") Can someone please help me find out how I can extract the weight from the SVM object *filter*. Your help is much appreciated. Best, -- Reza Salimi-Khorshidi, D.Phil. (Oxon) Analysis Group, FMRIB Centre of the University of Oxford Email: reza@fmrib.ox.ac.uk Address: FMRIB Centre, John Radcliffe Hospital, Oxford OX3 9DU, UK [[alternative HTML version deleted]]