h2o.find_threshold_by_max_metric: Find the threshold, give the max metric

View source: R/models.R

h2o.find_threshold_by_max_metricR Documentation

Find the threshold, give the max metric

Description

Find the threshold, give the max metric

Usage

h2o.find_threshold_by_max_metric(object, metric)

Arguments

object

H2OBinomialMetrics

metric

"F1," for example

Examples

## Not run: 
library(h2o)
h2o.init()

f <- "https://s3.amazonaws.com/h2o-public-test-data/smalldata/junit/cars_20mpg.csv"
cars <- h2o.importFile(f)
cars["economy_20mpg"] <- as.factor(cars["economy_20mpg"])
predictors <- c("displacement", "power", "weight", "acceleration", "year")
response <- "economy_20mpg"
cars_split <- h2o.splitFrame(data = cars, ratios = 0.8, seed = 1234)
train <- cars_split[[1]]
valid <- cars_split[[2]]
cars_gbm <- h2o.gbm(x = predictors, y = response, 
                    training_frame = train, validation_frame = valid, 
                    build_tree_one_node = TRUE , seed = 1234)
perf <- h2o.performance(cars_gbm, cars)
h2o.find_threshold_by_max_metric(perf, "fnr")

## End(Not run)

h2o documentation built on May 29, 2024, 4:26 a.m.