While using SVM in R through this code:
ctrl <- trainControl(method=“repeatedcv”,repeats = 10)
svmfit <- train(as.factor(Recommended) ~ ., data = train1,method = “svmRadial”,trControl = ctrl)
prediction <- predict(svmfit, newdata = test1, type = ‘raw’)
I got the following error:
As can be seen there are two levels in the prediction whereas there are none in the response column.
Now this has happened because before doing some feature engineering I had combined the train and test data:
#combine data set
test$Recommended <- 0
merge <- rbind(train, test)
Though this is not giving a problem in fitting a model however I would like to know how can i see the confusion matrix from this.
I am using caret and kernlab packages.
Can someone please help me with this???