Rpart 模型每个都取得了不同的结果 运行
Rpart model is achieving different results each run
我使用相同的训练集和测试集,但由于某种原因,混淆矩阵和输出图各不相同 运行。每次迭代达到两个精度之一:
fit_rpart <- train(goodbad~.,method='rpart',data=training, control = rpart.control(maxdepth = 30, minsplit=30, minbucket=1, cp=0.001))
fancyRpartPlot(fit_rpart$finalModel)
pred_rpart <- predict(fit_rpart, testing)
confusionMatrix(pred_rpart, testing$goodbad, positive = 'bad')
rpart
使用随机抽样。在每个 运行 之前使用 set.seed
,你应该每次都得到相同的模型。
set.seed(100)
fit_rpart <- train(goodbad~.,method='rpart',data=training, control = rpart.control(maxdepth = 30, minsplit=30, minbucket=1, cp=0.001))
fancyRpartPlot(fit_rpart$finalModel)
pred_rpart <- predict(fit_rpart, testing)
confusionMatrix(pred_rpart, testing$goodbad, positive = 'bad')
我使用相同的训练集和测试集,但由于某种原因,混淆矩阵和输出图各不相同 运行。每次迭代达到两个精度之一:
fit_rpart <- train(goodbad~.,method='rpart',data=training, control = rpart.control(maxdepth = 30, minsplit=30, minbucket=1, cp=0.001))
fancyRpartPlot(fit_rpart$finalModel)
pred_rpart <- predict(fit_rpart, testing)
confusionMatrix(pred_rpart, testing$goodbad, positive = 'bad')
rpart
使用随机抽样。在每个 运行 之前使用 set.seed
,你应该每次都得到相同的模型。
set.seed(100)
fit_rpart <- train(goodbad~.,method='rpart',data=training, control = rpart.control(maxdepth = 30, minsplit=30, minbucket=1, cp=0.001))
fancyRpartPlot(fit_rpart$finalModel)
pred_rpart <- predict(fit_rpart, testing)
confusionMatrix(pred_rpart, testing$goodbad, positive = 'bad')