Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the node number of the tree, thx for your reply #4776

Closed
hywchina opened this issue Aug 15, 2019 · 3 comments
Closed

the node number of the tree, thx for your reply #4776

hywchina opened this issue Aug 15, 2019 · 3 comments

Comments

@hywchina
Copy link

When I use XGB tree model, in a tree, the node number of the tree is continuous, some are discontinuous, may I ask why?

@trivialfis
Copy link
Member

@hywchina Could you give an example output? Also a reproducible script with used XGBoost version?

@hywchina
Copy link
Author

tree1

  1. booster[104]:node4 is a leaf, and the nodes number are discontinuous;

tree2
2. booster[39]:node19 is a leaf, but the nodes number are continuous;

booster[104] and booster[39] from different trees

thank you very much

@trivialfis
Copy link
Member

trivialfis commented Aug 15, 2019

@hywchina I'm not sure I follow, did you mean the node number being a continuous sequence like 1, 2, 3, ..., 7, 8, 9?

That's related to how the tree updaters split (and prune) each node. Splitting at 1 then the two children will be 2, 3. Then split at 2, 4, 5 will become children of 2. The children of 3 will be 6, 7, assuming depth-wise splitting scheme. If pruner is used, the deleted node number will be reused for later splits.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants