R 绘制多升力曲线

R 绘制多升力曲线,r,ggplot2,graph,lift,curve,R,Ggplot2,Graph,Lift,Curve,我是新手,正在努力学习。我试图在一张图中绘制多个分类器的提升曲线。我想不出一个办法。我知道下面两个分类器本质上是相同的,但它们都给出了不同的图,我只想将两者结合起来。下面是我试过的代码。有人能给我指一下正确的方向吗 fullmod = glm(Response ~ page_views_90d+win_visits+osx_visits+mc_1+mc_2+mc_3+mc_4+mc_5+mc_6+store_page+orders+orderlines+bookings+purchase

我是新手,正在努力学习。我试图在一张图中绘制多个分类器的提升曲线。我想不出一个办法。我知道下面两个分类器本质上是相同的,但它们都给出了不同的图,我只想将两者结合起来。下面是我试过的代码。有人能给我指一下正确的方向吗

    fullmod = glm(Response ~ page_views_90d+win_visits+osx_visits+mc_1+mc_2+mc_3+mc_4+mc_5+mc_6+store_page+orders+orderlines+bookings+purchase, data=training, family=binomial)
summary(fullmod)
fullmod.results <- predict(fullmod, newdata = testing, type='response')
plotLift(fitted.results, test_data_full$class, cumulative = TRUE,col="orange", n.buckets = 5)

redmod1 = glm(Response ~ win_visits+osx_visits+mc_2+mc_4+mc_6+store_page+orders+orderlines+bookings+purchase, data=training, family=binomial)
redmod1.results <- predict(redmod1, newdata = testing, type = 'response')
plotLift(redmod1.results, test_data_full$class, cumulative = TRUE,col="orange", n.buckets = 5)

# Attempt to plot multiple classifiers
plotLift((redmod1.results, fullmod.results), test_data_full$class, cumulative = TRUE,col="orange", n.buckets = 5)
fullmod=glm(响应~page_views_90d+win_visions+osx_visions+mc_1+mc_2+mc_3+mc_4+mc_5+mc_6+store_page+订单+订单行+预订+购买,数据=培训,家庭=二项)
摘要(fullmod)

fullmod.results这里有一种使用插入符号库绘制多个提升曲线的方法。但首先是一些数据:

set.seed(1)
for_lift <- data.frame(Class = factor(rep(1:2, each = 50)),
                       model1 = sort(runif(100), decreasing = TRUE),
                       model2 = runif(100),
                       model3 = runif(100))
并绘制它

xyplot(lift_curve, auto.key = list(columns = 3))

如果要使用ggplot进行打印:

library(ggplot2)

ggplot(lift_curve$data)+
  geom_line(aes(CumTestedPct, CumEventPct, color = liftModelVar))+
  xlab("% Samples tested")+
  ylab("% Samples found")+
  scale_color_discrete(guide = guide_legend(title = "method"))+
  geom_polygon(data = data.frame(x = c(0, lift_curve$pct, 100, 0),
                                 y = c(0, 100, 100, 0)),
               aes(x = x, y = y), alpha = 0.1)

感谢您的回复。你发布的是收益表。我正试图制作一张升力图。我可以用一个模型制作,但我不能用多个模型制作。你确实是对的。有多个升力曲线的定义浮动。请您在
x
y
轴上指定您想要的内容好吗?您很可能正在寻找:
ggplot(lift\u curve$data)+geom\u line(aes(cumtestedpt,lift,color=liftModelVar))
library(ggplot2)

ggplot(lift_curve$data)+
  geom_line(aes(CumTestedPct, CumEventPct, color = liftModelVar))+
  xlab("% Samples tested")+
  ylab("% Samples found")+
  scale_color_discrete(guide = guide_legend(title = "method"))+
  geom_polygon(data = data.frame(x = c(0, lift_curve$pct, 100, 0),
                                 y = c(0, 100, 100, 0)),
               aes(x = x, y = y), alpha = 0.1)