这才是我要的滑板鞋~~~~~
#glm模型
glm.model=train(y~.,data=data_train,
method="glm",
metric="ROC",
trControl=control)
#svm模型
svm.model=train(y~.,data=data_train,
method="svmRadial",
metric="ROC",
trControl=control)
##预测
glm.pred=predict(glm.model,data_test[,c(1:10)],type="prob")
svm.pred=predict(svm.model,data_test[,c(1:10)],type="prob")
##画出roc图
glm.roc=roc(response=data_test$y,predictor=glm.pred$yes,
levels=levels(data_test$y))
plot(glm.roc,type = "S",col="red")
svm.roc=roc(response=data_test$y,predictor=svm.pred$yes,
levels=levels(data_test$y))
plot(svm.roc,add = TRUE,col="green")
rpart.roc=roc(response=data_test$y,predictor=rpart.pred$yes,
levels=levels(data_test$y))
plot(rpart.roc,add = TRUE,col="blue")