How to get the samples in each leaf? (in R xgboost package)


#1

Hi,

By using R xgboost package, can I get to know which leaves the testing sample is in for each tree?
And find out the training sample which in the same leaves as the testing sample?
So that I can do more research of the xgboost model

Thank you.


#2

You can set predleaf=True in predict method.


#3

Thanks for your answer! I can easily get the leaf ID!