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

Obtain num boosted rounds directly from booster. #5511

Closed
wants to merge 6 commits into from

Conversation

trivialfis
Copy link
Member

The PR tries to remove the hack for obtaining number of boosted rounds in Python. I implemented the getter in c++ which directly counts the number of trees.

Most of the tests are already in tests/python/test_training_continuation.py, where best_ntree_limit is heavily tested.

Copy link
Member

@RAMitchell RAMitchell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm reluctant to create an API function for a single scalar variable unless there is no alternative. Can we get this information in another way?

@trivialfis
Copy link
Member Author

@RAMitchell

Can we get this information in another way?

Right now we are using len(get_dump()) and pick the parameters like num_parallel_tree and num_class in Python/R to calculate boosted rounds.

I'm reluctant to create an API function for a single scalar variable unless there is no alternative.

As #5460 being sorted out, I am thinking we give a shape attribute to the booster, like how many trees, how many output for each tree, how many groups, size of random forest etc ... Along the way we create a friendly API for specifying these attributes and remove related configuration in Learner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants