2022-06-15

Using xgboost random forest, how can you extract the prediction from each tree?

With the sklearn RandomForest, you can get the prediction of each tree of the random forest like so:

per_tree_pred = [tree.predict(X) for tree in clf.estimators_]

xgboost as the option of fitting random forest, which is quite nice since we can leverage the GPU, but is there any way to get the prediction from each tree like we can in sklearn? This can be very useful to get a sense of the uncertainty of the predictions.

Thanks,



No comments:

Post a Comment