on-internet
← Community

R: Number of classes is not equal to 2

Stack Overflow ·

I am getting the following error when trying to generate a lift chart for a random forest model being run through rattle: Error in prediction(crs$pr, no.miss) : Number of classes is not equal to 2. ROCR currently supports only evaluation of binary classification tasks. My code is as follows: # Evaluate model performance. # Lift Chart: requires the ROCR package. library(ROCR) # Obtain predictions for the rf model on TBA_jul21c.csv [**train**]. crs$pr <- predict(crs$rf, newdata=na.omit(crs$dataset[crs$sample, c(crs$input, crs$target)]), type="prob")[,2] # Remove observations with missing target.

Comments

Sign in or sign up to comment and upvote.

No comments yet.