开始使用免费开始使用

衡量逻辑回归模型的性能

把混淆矩阵保留为表对象也可以,但编程使用会有些不便。将其转换为 yardstick 的混淆矩阵对象后,您就能使用相应的方法来绘图并提取性能指标。

混淆矩阵 outcomes 作为表对象已提供。已加载 ggplot2 和 yardstick,并且已将 yardstick.event_first 选项设置为 FALSE。

本练习是课程的一部分

R 中的回归入门

查看课程

练习说明

  • 将 outcomes 转换为 yardstick 的混淆矩阵。赋值给 confusion。
  • 自动绘制 confusion。
  • 从 confusion 获取性能指标,并注意阳性类别在第 2 列。

交互式实操练习

通过完成这段示例代码来试试这个练习。

# Convert outcomes to a yardstick confusion matrix
confusion <- ___

# Plot the confusion matrix
___

# Get performance metrics for the confusion matrix
___
编辑并运行代码