h2o (version 3.10.3.6)

h2o.confusionMatrix: Access H2O Confusion Matrices

Description

Retrieve either a single or many confusion matrices from H2O objects.

Usage

h2o.confusionMatrix(object, ...)

# S4 method for H2OModel h2o.confusionMatrix(object, newdata, valid = FALSE, ...)

# S4 method for H2OModelMetrics h2o.confusionMatrix(object, thresholds = NULL, metrics = NULL)

Arguments

object
Either an object or an object.
...
Extra arguments for extracting train or valid confusion matrices.
newdata
An H2OFrame object that can be scored on. Requires a valid response column.
valid
Retrieve the validation metric.
thresholds
(Optional) A value or a list of valid values between 0.0 and 1.0. This value is only used in the case of objects.
metrics
(Optional) A metric or a list of valid metrics ("min_per_class_accuracy", "absolute_mcc", "tnr", "fnr", "fpr", "tpr", "precision", "accuracy", "f0point5", "f2", "f1"). This value is only used in the case of objects.

Value

Calling this function on objects returns a confusion matrix corresponding to the predict function. If used on an object, returns a list of matrices corresponding to the number of thresholds specified.

Details

The version of this function will only take or objects. If no threshold is specified, all possible thresholds are selected.

See Also

predict for generating prediction frames, h2o.performance for creating .

Examples

Run this code
library(h2o)
h2o.init()
prosPath <- system.file("extdata", "prostate.csv", package="h2o")
hex <- h2o.uploadFile(prosPath)
hex[,2] <- as.factor(hex[,2])
model <- h2o.gbm(x = 3:9, y = 2, training_frame = hex, distribution = "bernoulli")
h2o.confusionMatrix(model, hex)
# Generating a ModelMetrics object
perf <- h2o.performance(model, hex)
h2o.confusionMatrix(perf)

Run the code above in your browser using DataCamp Workspace