比较模型

在 R 中使用 caret 的机器学习

Zach Mayer

Data Scientist at DataRobot and co-author of caret

比较模型

  • 确保使用了相同的数据进行拟合!
  • 选择标准
    • AUC 平均值最高
    • AUC 标准差最低
  • resamples() 函数很有用
在 R 中使用 caret 的机器学习

示例:在流失数据上使用 resamples()

# Make a list
model_list <- list(
  glmnet = model_glmnet,
  rf = model_rf
)
# Collect resamples from the CV folds
resamps <- resamples(model_list)
resamps
Call:
resamples.default(x = model_list)

Models: glmnet, rf 
Number of resamples: 5 
Performance metrics: ROC, Sens, Spec 
Time estimates for: everything, final model fit 
在 R 中使用 caret 的机器学习

结果汇总

# Summarize the results
summary(resamps)
Call:
summary.resamples(object = resamps)

Models: glmnet, rf 
Number of resamples: 5 

ROC 
         Min. 1st Qu. Median   Mean 3rd Qu.   Max. NA's
glmnet 0.7526  0.7624 0.7719 0.7686  0.7722 0.7840    0
rf     0.8984  0.9028 0.9077 0.9061  0.9093 0.9125    0
在 R 中使用 caret 的机器学习

Let's practice!

在 R 中使用 caret 的机器学习

Preparing Video For Download...