Learn R Programming

Laurae (version 0.0.0.9001)

lgbm.metric: LightGBM Metric Output

Description

This function allows to get the metric values from a LightGBM log.

Usage

lgbm.metric(model, metrics = TRUE, data.table = TRUE)

Arguments

model
Type: list, vector of characters, character. If a list, it should come from a trained model. If a vector of characters, it must be the model text. If a character, it must be the exact file path to the log file. It cannot work without training with verbose set to FALSE.
metrics
Type: boolean. Whether to return the metrics table (TRUE) or the best iteration (FALSE).
data.table
Type: boolean. Whether to return a data.table (TRUE) or a data.frame (FALSE). Defaults to TRUE. Useless when metrics is set to FALSE.

Value

A data.table (or data.frame) with 3 to N columns, with at least: c("Iteration", "Total_Time", "Round_Time").

Examples

Run this code
## Not run: ------------------------------------
# # Get the metrics of the model trained (requires verbose = FALSE during training)
# lgbm.metric(workingdir = trained[["Path"]],
# log_name = trained[["Log"]],
# metrics = TRUE,
# data.table = TRUE)
# 
# # Get the best iteration of the model trained (requires verbose = FALSE during training)
# lgbm.metric(workingdir = trained[["Path"]],
# log_name = trained[["Log"]],
# metrics = FALSE)
## ---------------------------------------------

Run the code above in your browser using DataLab