slim-trees
slim-trees copied to clipboard
Add support for linear trees and `num_cat > 0`
In gbdt_model_text.cpp GBDT::LoadModelFromString we can see how a model string should look like in LGBM.
When looking into tree.cpp Tree::Tree, we can see that there are linear trees as well as trees with num_cat > 0.
The current implementation doesn't support these options yet.
For testing purposes, we can generate linear trees using
regressor = lgb.LGBMRegressor(n_estimators=100, random_state=42, linear_trees=True)
regressor.fit(*generate_dataset(n_samples=10000))
Just as reference: (feature name, number of values)
('num_leaves', 1)
('num_cat', 1)
('split_feature', 30)
('split_gain', 30)
('threshold', 30)
('decision_type', 30)
('left_child', 30)
('right_child', 30)
('leaf_value', 31)
('leaf_weight', 31)
('leaf_count', 31)
('internal_value', 30)
('internal_weight', 30)
('internal_count', 30)
('is_linear', 1)
('leaf_const', 31)
('num_features', 31)
('leaf_features', 217)
('leaf_coeff', 217)
('shrinkage', 1)