Learn R Programming

h2o (version 3.44.0.3)

h2o.make_metrics: Create Model Metrics from predicted and actual values in H2O

Description

Given predicted values (target for regression, class-1 probabilities or binomial or per-class probabilities for multinomial), compute a model metrics object

Usage

h2o.make_metrics(
  predicted,
  actuals,
  domain = NULL,
  distribution = NULL,
  weights = NULL,
  treatment = NULL,
  auc_type = "NONE",
  auuc_type = "AUTO",
  auuc_nbins = -1,
  custom_auuc_thresholds = NULL
)

Value

Returns an object of the H2OModelMetrics subclass.

Arguments

predicted

An H2OFrame containing predictions

actuals

An H2OFrame containing actual values

domain

Vector with response factors for classification.

distribution

Distribution for regression.

weights

(optional) An H2OFrame containing observation weights.

treatment

(optional, for uplift models only) An H2OFrame containing treatment column for uplift classification.

auc_type

(optional) For multinomial classification you have to specify which type of agregated AUC/AUCPR will be used to calculate this metric.

auuc_type

(optional) For uplift binomial classification you have to specify which type of AUUC will be used to calculate this metric. Possibilities are gini, lift, gain, AUTO. Default is AUTO which means qini.

auuc_nbins

(optional) For uplift binomial classification you can specify number of bins to be used for calculation the AUUC. Default is -1, which means 1000.

custom_auuc_thresholds

(optional) For uplift binomial classification you can specify exact thresholds to calculate AUUC. Default is NULL. If the thresholds are not defined, auuc_nbins will be used to calculate new thresholds from the predicted data.

Examples

Run this code
if (FALSE) {
library(h2o)
h2o.init()
prostate_path <- system.file("extdata", "prostate.csv", package = "h2o")
prostate <- h2o.uploadFile(path = prostate_path)
prostate$CAPSULE <- as.factor(prostate$CAPSULE)
prostate_gbm <- h2o.gbm(3:9, "CAPSULE", prostate)
pred <- h2o.predict(prostate_gbm, prostate)[, 3] ## class-1 probability
h2o.make_metrics(pred, prostate$CAPSULE)
}

Run the code above in your browser using DataLab