我一直在尝试从我的逻辑回归中制作一条提升曲线,但它似乎不起作用。
遵循我一直在尝试的代码
inTrain <- createDataPartition(y = Data$Response, p = .60, list = FALSE)
training <- Data[inTrain,]
testing <- Data[-inTrain,]
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, family=binomial(logit),data=training )
lift.chart(c("fullmod"), data=training, targLevel="Yes",
trueResp=0.01, type="incremental", sub="Test")
我不断收到以下错误,
Error in lift.chart(c("fullmodWorks"), data = DataVal, targLevel = 1, :
The y variable must be a two-level factor.
在创建训练/测试分区之前尝试此操作。
Data$Response <- as.factor(Data$Response)