tabular_trees.BoosterString

class tabular_trees.BoosterString(rows)[source]

Bases: object

String version of a LightGBM Booster.

__init__(rows)[source]

Initialise the BoosterString from a list of strings.

Parameters:

rows (list[str]) – List of strings defining a Booster.

Methods

__init__(rows)

Initialise the BoosterString from a list of strings.

extract_bottom_rows()

Return all rows after the 'end of trees' line to the end.

extract_header_rows()

Extract the header rows from BoosterString object.

extract_tree_rows(tree_number)

Extract rows for given tree number.

from_booster(booster)

Create BoosterString from a lgb.Booster object.

to_booster()

Convert the BoosterString back to a Booster.

Attributes

new_line

extract_bottom_rows()[source]

Return all rows after the ‘end of trees’ line to the end.

Returns:

rows – Final rows from Booster text.

Return type:

list[str]

extract_header_rows()[source]

Extract the header rows from BoosterString object.

Returns:

rows – Header rows from Booster text.

Return type:

list[str]

extract_tree_rows(tree_number)[source]

Extract rows for given tree number.

Returns:

rows – Rows from Booster text for the given tree.

Return type:

list[str]

classmethod from_booster(booster)[source]

Create BoosterString from a lgb.Booster object.

Returns:

model – Model as a BoosterString object.

Return type:

BoosterString

to_booster()[source]

Convert the BoosterString back to a Booster.

Returns:

model – BoosterString as lgb.Booster object.

Return type:

lgb.Booster