Hi all! I am having problems with using SVM in R I have a data frame `trainData` which contains 198 rows and looks like
Matchup Win HomeID AwayID A_TWPCT A_WST6 A_SEED B_TWPCT B_WST6 B_SEED2010_1115_1457 1 1115 1457 0.531 5 16 0.567 4 16 2010_1124_1358 1 1124 1358 0.774 5 3 0.75 5 14 ... The testData is similar. In order to use SVM, I have to change the response variable Win to a factor. I tried the below: trainDataSVM <- trainData trainDataSVM$Win <- factor(trainDataSVM$Win) svmfit =svm (Win ~ A_WST6 + A_SEED + B_WST6 + B_SEED , data = trainDataSVM , kernel ="linear", cost =10,scale =FALSE, probability=TRUE ) testDataSVM<-testData testDataSVM$Win <-factor(testDataSVM$Win) predictions_SVM <- predict(bestmod, testDataSVM, type = "response",probability=TRUE) However, I get the message Error in matrix(ret$prob, nrow = nrow(newdata), byrow = TRUE, dimnames = list(rowns, : length of 'dimnames' [2] not equal to array extent If I re-run the code except not changing trainDataSVM$Win and testDataSVM$Win to factors, if I print out predictions_SVM, I get the message named numeric(0) How do I fix this? Thanks! [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.