Hi All, I am trying to use the "Kernlab" package for training and prediction using SVM's. I am getting the following error when I am trying to use the predict function:
> predictSvm = predict(modelforSVM, testSeq); Error in `contrasts<-`(`*tmp*`, value = "contr.treatment") : contrasts can be applied only to factors with 2 or more levels The training file is a data frame with 501 columns: Col 1 is "Class" which is "+" or "-" and Cols V1 to V500 are "A/C/G/T" . There are 200 seq's for training (100 + and - each) The model that I have generated is as follows: modelforSVM <- ksvm(Class ~ ., data = train500, kernel = "rbfdot", kpar = "automatic", C = 60, cross = 3, prob.model = TRUE) The testSeq is a vector of 500 characters casted as a data.frame. I tried adding the Class column as well later to the testSeq data frame but got the same error. I am using R with windows, 32 bit, version 2.9.0 Any help is much appreciated. Thanks, Vishal -- Vishal Thapar, Ph.D. Post Doctoral Researcher Cold Spring Harbor Lab Williams Bldg 1 Bungtown Road Cold Spring Harbor, NY - 11724 [[alternative HTML version deleted]] ______________________________________________ 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.