pr_data <- df_total %>%
group_by(fold) %>%
pr_curve(truth = truth, .pred_1)
pr <- pr_data %>%
filter(fold %in% c(1,2)) %>%
ggplot(aes(recall, precision,col = fold)) +
geom_path() +
ggtitle("Precision - Recall Curve")
pr
我有这行代码,其中pr_data具有每折(共5折)的PR曲线数据。
我正在尝试绘制同一图中每个折痕的精确召回曲线。
当我分别绘制折叠1和2时,图中没有奇怪的垂直线,但是当我一起绘制它们时,我得到了奇怪的垂直线。另外,我的传说很奇怪,当我只有折叠1和2时,折叠为1、1.25、1.5、1.75和2。
这些是pr_data的前几行
fold .threshold recall precision
1 Inf 0.000000000 1.0000000
1 0.9663363 0.009433962 1.0000000
1 0.9608003 0.018867925 1.0000000
1 0.9009111 0.028301887 1.0000000
1 0.8960981 0.037735849 1.0000000
1 0.8939032 0.047169811 1.0000000
编辑:我想解决要解决的怪异问题,我必须在group
中添加一个aes
参数。仍在研究如何更改图例。