How to convert leaf indices to output (weight) of each tree leaf nodes?

I am using the XGBoost Python API to train a model with the multi_strategy parameter set to multi_output_tree.

I am able to get the leaf indices for each tree using the predict() method with the pred_leaf parameter set to True. However, I am not sure how to convert these leaf indices to the output of each tree (weights) and add with the base score to get the output of the model manually.

Specifically, I am trying to do the following:

  1. Get the leaf indices for each tree using the predict() method with the pred_leaf parameter set to True.
  2. For each tree and leaf index, get the output value vector of the tree.
  3. Add the output values from all of the trees to get the final output of the model.

Basically, I am looking for something like a booster.get_nodes_weights() method. This method would return a list of lists, where each sublist contains the output values of the nodes in a single tree.

Is there any way to do this?

Additionally, I am wondering if there is any way to set the leaf values of the trees manually. This would be useful for implementing a “fine tuning” update.
I know about refresh update in updater options, but what i’m looking for is for example to change leaf values with SGD with Momentum after the tree structure is formed.

Thanks in advance for your help!

Additional information:

  • I am using the following version of XGBoost: xgboost==2.0.0
  • I am training my model with multi_strategy parameter set to multi_output_tree
  • booster.get_dump method is not clean and doesn’t work for in multi_output_tree setting.

Hi, as documented, the parameter for vector leaf is still working in progress, all it does at the moment is basic training and inference, anything not shown in the demo can be considered not working.

@jiamingy Thanks for your reply!
Where can i see what features are available for multi_output_tree or planned for the future release?

https://github.com/dmlc/xgboost/issues/9043 This is the tracking issue

1 Like