建模

    imodel <- ksvm(group~.,
         data=input)

预测

 predicted <- predict(imodel,newdata = input,type="response")
    error_rate <- ModelMetrics::ce(input$group,predicted)

参数筛选

  svm_grid <- expand.grid(sigma=2^(-10:4),C=-5:20)
  set.seed(2012)
   imodel <- train(group~.,data = input,
                   method ="svmRadial",
                   preProc=c("center","scale"),tuneGrid =svm_grid )
   imodel$bestTune

参考