Last chance! 50% off unlimited learning
Sale ends in
Retrieve either a single or many confusion matrices from H2O objects.
h2o.confusionMatrix(object, ...)# S4 method for H2OModel
h2o.confusionMatrix(object, newdata, valid = FALSE, ...)
# S4 method for H2OModelMetrics
h2o.confusionMatrix(object, thresholds = NULL, metrics = NULL)
Extra arguments for extracting train or valid confusion matrices.
An H2OFrame object that can be scored on. Requires a valid response column.
Retrieve the validation metric.
Calling this function on '>H2OModel objects returns a
confusion matrix corresponding to the predict
function.
If used on an '>H2OBinomialMetrics object, returns a list
of matrices corresponding to the number of thresholds specified.
The '>H2OModelMetrics version of this function will only take '>H2OBinomialMetrics or '>H2OMultinomialMetrics objects. If no threshold is specified, all possible thresholds are selected.
predict
for generating prediction frames,
h2o.performance
for creating
'>H2OModelMetrics.
# NOT RUN {
library(h2o)
h2o.init()
prostate_path <- system.file("extdata", "prostate.csv", package = "h2o")
prostate <- h2o.uploadFile(prostate_path)
prostate[,2] <- as.factor(prostate[,2])
model <- h2o.gbm(x = 3:9, y = 2, training_frame = prostate, distribution = "bernoulli")
h2o.confusionMatrix(model, prostate)
# Generating a ModelMetrics object
perf <- h2o.performance(model, prostate)
h2o.confusionMatrix(perf)
# }
Run the code above in your browser using DataLab