Learn R Programming

h2o (version 2.8.4.4)

plot.H2OPerfModel: Scatterplot of H2O Performance Measures

Description

Draw scatter plot of a particular performance measure vs. thresholds for a H2O model, or the ROC curve.

Usage

## S3 method for class 'H2OPerfModel':
plot(x, type = "cutoffs", ...)

Arguments

x
An H2OPerfModel object.
type
Either "cutoffs" to plot the performance measure x@perf versus thresholds x@cutoffs, or "roc" to plot the corresponding ROC curve (true positive rate vs. false positive rate).
...
Arguments to be passed to methods, such as graphical parameters (see par for details).

See Also

H2OPerfModel, h2o.performance

Examples

Run this code
library(h2o)
localH2O = h2o.init()

# Run GBM classification on prostate.csv
prosPath = system.file("extdata", "prostate.csv", package = "h2o")
prostate.hex = h2o.importFile(localH2O, path = prosPath, key = "prostate.hex")
prostate.gbm = h2o.gbm(y = 2, x = 3:9, data = prostate.hex)

# Calculate performance measures at threshold that maximizes precision
prostate.pred = h2o.predict(prostate.gbm)
prostate.perf = h2o.performance(prostate.pred[,3], prostate.hex$CAPSULE, measure = "precision")

plot(prostate.perf, type = "cutoffs")     # Plot precision vs. thresholds
plot(prostate.perf, type = "roc")         # Plot ROC curve

Run the code above in your browser using DataLab