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

[R-package] allow access to params in Booster #3662

Merged
merged 10 commits into from
Jan 3, 2021

Conversation

jameslamb
Copy link
Collaborator

I've been trying to check LightGBM questions on Stack Overflow more frequently. A search today led me to this question from two years ago: https://stackoverflow.com/questions/49674112/accessing-lightgbm-model-parameters/50115384#50115384.

It pointed out that there's no way to access the parameters from Booster object. This is something that the Python package has had for a while.

Storing the parameters in the Booster can be helpful for cases where you've saved a model and then later load it in a session that doesn't have the original training code available. For example, you might want to be sure that the parameters you use for training continuation are the same as those you used in the original training. Or you might want to use parameters as metadata in a model monitoring system.

This pull request adds a new public attribute, Booster$params. Just like Booster.params in the Python package, it includes all passed-in parameters AND any parameters on the Dataset used for training (such as max_bin).

This PR also adds the first set of tests on saveRDS.lgb.booster() and readRDS.lgb.booster(), which were previously not covered by any tests.

@StrikerRUS
Copy link
Collaborator

(Shouldn't prevent to merge this PR) but I just want to say that a more general fix will be loading params from cpp side: #2613 (comment)

@jameslamb jameslamb merged commit 532fa91 into microsoft:master Jan 3, 2021
@jameslamb jameslamb deleted the feat/booster-params branch January 3, 2021 04:26
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants