tabular_trees.BoosterTree

class tabular_trees.BoosterTree(tree, num_leaves, num_cat, split_feature, split_gain, threshold, decision_type, left_child, right_child, leaf_value, leaf_weight, leaf_count, internal_value, internal_weight, internal_count, is_linear, shrinkage)[source]

Bases: object

Data class for individual LightGBM trees.

__init__(tree, num_leaves, num_cat, split_feature, split_gain, threshold, decision_type, left_child, right_child, leaf_value, leaf_weight, leaf_count, internal_value, internal_weight, internal_count, is_linear, shrinkage)

Methods

__init__(tree, num_leaves, num_cat, ...)

get_booster_sting()

Concatenate tree information to a single string.

get_booster_string_rows()

Convert data to rows that could be concatenated to part of BoosterString.

Attributes

tree

Tree index.

num_leaves

Number of leaves in tree.

num_cat

split_feature

Split feature indexes for internal nodes.

split_gain

Split gain for internal nodes.

threshold

Split threshold for internal nodes.

decision_type

2 for ordered splits.

left_child

Left child node indexes.

right_child

Right child node indexes.

leaf_value

Leaf predictions.

leaf_weight

Sum of Hessian for rows in the leaf node.

leaf_count

Number of rows in the leaf node.

internal_value

Prediction for internal nodes.

internal_weight

Sum of Hessian for rows in the internal node.

internal_count

Number of rows in the internal node.

is_linear

shrinkage

decision_type

2 for ordered splits.

get_booster_sting()[source]

Concatenate tree information to a single string.

Returns:

model – Booster as a string.

Return type:

str

get_booster_string_rows()[source]

Convert data to rows that could be concatenated to part of BoosterString.

internal_count

Number of rows in the internal node.

internal_value

Prediction for internal nodes.

internal_weight

Sum of Hessian for rows in the internal node.

leaf_count

Number of rows in the leaf node.

leaf_value

Leaf predictions.

leaf_weight

Sum of Hessian for rows in the leaf node.

left_child

Left child node indexes.

Leaf nodes indexes are negative and indexed from -1.

num_leaves

Number of leaves in tree.

right_child

Right child node indexes.

Leaf nodes indexes are negative and indexed from -1.

split_feature

Split feature indexes for internal nodes.

split_gain

Split gain for internal nodes.

threshold

Split threshold for internal nodes.

tree

Tree index.