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] clarify parameter documentation (fixes #4193) #4202

Merged
merged 3 commits into from
Apr 19, 2021
Merged

Conversation

jameslamb
Copy link
Collaborator

This PR proposes some clarifications in the R documentation, based on the feedback in #4193.

Notes for Reviewers

Pushing to the branch docs/jlamb so we can check the rendered docs on readthedocs.

@jameslamb jameslamb added the doc label Apr 19, 2021
@jameslamb jameslamb requested a review from Laurae2 as a code owner April 19, 2021 15:07
@jameslamb jameslamb requested a review from StrikerRUS April 19, 2021 15:07
#' @param callbacks List of callback functions that are applied at each iteration.
#' @param reset_data Boolean, setting it to TRUE (not the default value) will transform the
#' booster model into a predictor model which frees up memory and the
#' original datasets
#' @param ... other parameters, see Parameters.rst for more information. A few key parameters:
#' @param ... other parameters, see \href{https://lightgbm.readthedocs.io/en/latest/Parameters.html}{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just a question: how this differs from params (the first one) argument?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

unfortunately, they both can take the exact same information. And then they get merged together:

additional_params <- list(...)
params <- append(params, additional_params)
.

That has been a part of this project's R package since before I joined LightGBM, so for several years. Now that we're saying that the next release will be 4.0.0 and breaking changes will be allowed, I would love to get rid of support for ... and force people to be more explicit. I think it introduces extra complexity for no benefit.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There is a very real functional downside of allowing ..., I should have mentioned it in my comment. If you misspell one of the keyword arguments, it will just be assumed that you are referring to a LightGBM parameter.

So if you use, say, lgb.train(resetting_data = TRUE), training will proceed with reset_data still set to the default (TRUE) and you'll get a warning in logs like [LightGBM ] [WARN] unrecognized parameter: 'resetting_data'.

If we didn't support ..., then you'd get an error (not a warning) in R immediately like "unrecognized argument: resetting_data", which I think is desirable.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would love to get rid of support for ...

Yeah, good idea I think!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll add a feature request. And @ some of the people who've opened R issues here in the past for their thoughts.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I just created #4226

@jameslamb
Copy link
Collaborator Author

I did check https://lightgbm.readthedocs.io/en/docs-jlamb/R/reference/ to be sure this is looking ok. The RTD build passed (https://readthedocs.org/projects/lightgbm/builds/) and visually it seems good to me so I'll merge.

for example, https://lightgbm.readthedocs.io/en/docs-jlamb/R/reference/lgb.train.html

image

@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 23, 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.

2 participants