Learn R Programming

h2o (version 3.44.0.3)

h2o.logloss: Retrieve the Log Loss Value

Description

Retrieves the log loss output for a H2OBinomialMetrics or H2OMultinomialMetrics object If "train", "valid", and "xval" parameters are FALSE (default), then the training Log Loss value is returned. If more than one parameter is set to TRUE, then a named vector of Log Losses are returned, where the names are "train", "valid" or "xval".

Usage

h2o.logloss(object, train = FALSE, valid = FALSE, xval = FALSE)

Arguments

object

a H2OModelMetrics object of the correct type.

train

Retrieve the training Log Loss

valid

Retrieve the validation Log Loss

xval

Retrieve the cross-validation Log Loss

Examples

Run this code
if (FALSE) {
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_splits <- h2o.splitFrame(data =  cars, ratios = .8, seed = 1234)
train <- cars_splits[[1]]
valid <- cars_splits[[2]]
car_drf <- h2o.randomForest(x = predictors, 
                            y = response, 
                            training_frame = train, 
                            validation_frame = valid)
h2o.logloss(car_drf, train = TRUE, valid = TRUE)
}

Run the code above in your browser using DataLab