lgb.model.dt.tree {lightgbm}R Documentation

Parse a LightGBM model json dump

Description

Parse a LightGBM model json dump into a data.table structure.

Usage

lgb.model.dt.tree(model, num_iteration = NULL)

Arguments

model

object of class lgb.Booster

num_iteration

number of iterations you want to predict with. NULL or <= 0 means use best iteration

Value

A data.table with detailed information about model trees' nodes and leafs.

The columns of the data.table are:

Examples


data(agaricus.train, package = "lightgbm")
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)

params <- list(objective = "binary",
              learning_rate = 0.01, num_leaves = 63, max_depth = -1,
              min_data_in_leaf = 1, min_sum_hessian_in_leaf = 1)
              model <- lgb.train(params, dtrain, 20)
model <- lgb.train(params, dtrain, 20)

tree_dt <- lgb.model.dt.tree(model)


[Package lightgbm version 2.2.2 Index]