The SVM algorithm is not available in the h2o package. To train the SVM classifier, we are going to use the caret package. Remember that our target value takes two different values:
levels(train$Default) ## [1] "0" "1"
Although the different values of this variable (0 and 1) do not display problems in other algorithms, in this case, we need to make a little transformation here. The categories in the target variable can only take values like X0 or X1, so we need to transform them. Let's write some code for this:
levels(train$Default) <- make.names(levels(factor(train$Default)))levels(train$Default) ## [1] "X0" "X1"
These values are also transformed in the test sample:
test$Default<-as.factor(test$Default)levels(test$Default) ...