Vanessa F
Vanessa F

Reputation: 11

Error Message when plotting ROC of H2O Model Object in R

Trying to plot ROC curve for H2O Model Object in R, however, I keep receiving the following error message:

"Error in as.double(y) : cannot coerce type 'S4' to vector of type 'double'"

My code is as follows:

drf1 <- h2o.randomForest(x=x,y=y,training_frame = train,validation_frame = valid, nfolds = nfolds, fold_assignment = "Modulo",keep_cross_validation_predictions = TRUE,seed = 1)

plot((h2o.performance(drf1,valid = T)), type = "roc")

I followed suggestions found here: How to directly plot ROC of h2o model object in R

Any help would be greatly appreciated!

Upvotes: 1

Views: 361

Answers (1)

Ralph Deint
Ralph Deint

Reputation: 380

From the error, I think your response variable is not binary. You can change your response variable to factor before putting it into model. i.e.

df$y <- as.factor(df$y)

"ROC is a graphical plot that illustrates the diagnostic ability of a binary classifier system as its discrimination threshold is varied".

source: ROC wiki

Upvotes: 1

Related Questions