On 7/5/05, Uwe Ligges <[EMAIL PROTECTED]> wrote: > Uwe Ligges wrote: > > > Soma Saha wrote: > > > >> Hi! > >> > >> I got the following runtime error when I tried to use svm method with > >> stepclass. > >> > >> Error in "colnames<-"(`*tmp*`, value = c("0", "1")) : > >> attempt to set colnames on object with less than two dimensions > >> > >> I repeated the same sequence of statements but this time I used the > >> classification function used in the example, i.e., "lda" and it worked > >> fine but I got the same error when I tried randomForest. > >> > >> As the same script worked with a different classification function, I am > >> wondering if stepclass works with svm and randomForest. > >> > >> I using R version 2.0.1 on a Linux machine. I am including the R script I > >> used below. > >> > >> I would be grateful for any suggestion on how to make stepclass work with > >> these classification functions. > >> > >> I would also like to make stepclass work with knn but knn does not have a > >> 'predict' method, which is a requirement for a classification method to > >> work with stepclass. Is there any way to get around this? > >> > >> Thanks, > >> Soma > >> > >> > >> > >> library("e1071") > >> library("randomForest") > >> library("klaR") > >> > >> td <- read.table("dgdata1.txt", header=TRUE, sep=",") > >> dgenes <- subset(td, dg == 1, select = dg:eg) > >> ndgenes <- subset(td, dg == 0, select = dg:eg) > >> n1 <- nrow(dgenes) > >> n2 <- nrow(ndgenes) > >> ndgrows <- 1:n2 > >> selrows <- sample(ndgrows) > >> sndgenes <- ndgenes[selrows[1:n1],] > >> > >> train <- rbind(dgenes, sndgenes) > >> attach(train) > >> traind <- subset(train, select = -dg) > >> trainr <- factor(dg) > >> detach(train) > >> > >> sc_res <- stepclass(traind, trainr, "svm", direction = "forward", > >> criterion = "AC", fold = 10) > > > > > > Looks like predict.svm does not always return "probabilities" in all > > cases, hence cannot be used in your case, I guess. > > svmlight (interface in in packages klaR) will do, though. You also might > > want to use sknn() (also package klaR), since it has a predict method > > rather than knn(). > > > > For randomForest, we will enhance stepclass() to support it in future. > > I just told nonsense, stepclass() does not make sense with > randomForest(), obviously ... (wonder why nobody shouted?)
Oh, we're just so used to you talking nonsense that we don't bother to point it out any more :-) ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html