i training glm model class attribute 'adverse_effects' factor containing 0 , 1
ctrl <- traincontrol(method = "cv", number = 5) model_logreg <- train(adverse_effects ~.,family=binomial(link='logit'),data=trainsplit_logreg, method = "glm", trcontrol = ctrl) predictors <- names(trainsplit_logreg)[names(trainsplit_logreg) != 'adverse_effects'] pred_logreg <- predict(model_logreg$finalmodel, testsplit_logreg[,predictors])
this summary of predictions
summary(pred_logreg) min. 1st qu. median mean 3rd qu. max. -14.5600 -2.1220 -1.8700 -1.9890 -1.7090 -0.9459
how know cut off point of prediction? how can map results of prediction 0s , 1s?
p.s got auc of 0.6144
predict.glm
takes type
argument determines scale on make predictions. think want type="response"
, try
predict(model_logreg$finalmodel, testsplit_logreg[,predictors], type="response")
the natural cutoff 0.5, select outcome. unless have special situation (e.g. false negative worse false positive) stick 0.5 cutoff.
Comments
Post a Comment