compute_metrics

  • Available in: Naïve-Bayes, PCA
  • Hyperparameter: yes

Description

The compute_metrics option specifies to compute metrics on the training data. This option is enabled by default.

Example

  • r
  • python
library(h2o)
h2o.init()

# import the prostate dataset:
prostate <- h2o.importFile("http://s3.amazonaws.com/h2o-public-test-data/smalldata/prostate/prostate.csv.zip")

# Converting CAPSULE, RACE, DCAPS, and DPROS to categorical
prostate$CAPSULE <- as.factor(prostate$CAPSULE)
prostate$RACE <- as.factor(prostate$RACE)
prostate$DCAPS <- as.factor(prostate$DCAPS)
prostate$DPROS <- as.factor(prostate$DPROS)

# Compare with Naive Bayes when x = 3:9, y = 2, and do not compute metrics
prostate.nb <- h2o.naiveBayes(x = 3:9, y = 2, training_frame = prostate, laplace = 0, compute_metrics = FALSE)
print(prostate.nb) # Note that metrics are not computed and, thus, do not display.

# Predict on training data
prostate.pred <- predict(prostate.nb, prostate)
print(head(prostate.pred))