Prashant kumar
Prashant kumar

Reputation: 1

Error: Response and predictor must be vectors of the same length

I'm getting following error, how to fix it?

install.packages("pROC")
library(pROC)
lr_predict <- predict(lg_model,train_data, probability =TRUE)
auc_gbm = roc(test_data$Class,lr.predict,plot = TRUE, col = "blue")

Setting levels: control = 0, case = 1
Error in roc.default(test_data$Class, lr.predict, plot = TRUE, col = "blue") :
    Response and predictor must be vectors of the same length.

Upvotes: 0

Views: 3632

Answers (1)

garcesj
garcesj

Reputation: 599

Following the response of @Shirin Yavari, you could use a code like that:

lr_predict <- predict(lg_model, test_data, probability =TRUE)
auc_gbm = roc(test_data$Class, lr.predict, plot = TRUE, col = "blue")

Upvotes: 1

Related Questions