-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
[RFC] [R-package] Remove support for passing parameters through '...' #4226
Comments
Before we move forward with this change, I'd like to ask some of the people I know to be users of the R package to weigh in. And of course anyone else is welcome to give their feedback on the idea!
Thanks very much to all of you for your time and effort! |
Thanks for the R support! I think it is a very good idea to simplify the interface in this way. It doesn't only simplify the code but also improves the help in some cases. E.g. for |
Dear developers, Many thanks for the support ! |
I am using LGBM via treesnip these days so this affects my code. I would like to wait for opinions from the maintainers of treesnip. However, if the functions support every parameter through |
Thanks! I think that I think it could be changed to instead collect those and pass them to |
That wouldn't break the existing code, since arguments which are in |
@david-cortes I don't think that's correct. Consider my example at the top of this issue with LightGBM/R-package/R/lgb.train.R Lines 86 to 87 in 5014f19
To be clear, this proposal is not about adding one keyword argument to |
I think one of the biggest complaints about A params list feels very outdated for R. I think it's still popular in Python, but not so much in R anymore. If you do go this route, rather than making it a list where the user can enter anything and has no guidance, make it a function whose arguments are the parameters. An example can be seen in Though generally, I like keyword arguments in the function itself. This means I can use autocomplete in the IDE and all the documentation is in one place and feels less clunky than a params list. That said, I know it is possible to get autocomplete to work even with As an aside, you used |
Thanks very much!
Yes, #4195 is the proposal for exactly what you're talking about. To be clear, removing the interface of passing a If there is some other API change you'd like to see in this project's R package (besides #4195), we'd welcome issues describing a proposal and how it is an improvement over the current state.
I think you're probably talking about how some packages use the With that tag, if you set up your stuff like this: #' @name some_func
#' @inheritDotParams data.table::data.table
some_func <- function(...) {
someDT <- data.table::data.table(...)
return(someDT)
}
In the earliest days of this project's R package, some explicit keyword arguments were added for functions like |
We might add a depreciation note in the next R release, like so
|
Thanks for tagging in this RFC, just catching up here, but I think any work to simplify the interface would go a long way to improving maintainability of wrappers that try to expose LightGBM functionality (like the wrapper in In |
Thanks very much @nhejazi ! In the future, if you run into anything in LightGBM that you're unsure about you're welcome to come here and open an issue. We'd be happy to help, and you might help us to uncover bugs or other opportunities to improve the interface. This is especially important right now, as we're preparing a 4.0.0 release and are open to the possibility of breaking changes if a strong case can be made for them.
@mayer79 great suggestion! Generally, I agree with you. However depending on when #3234 is merged, there might not be another minor release of LightGBM between now and 4.0. Maintainers decided in #3210 to continue releasing the entire project together, instead of having individual minor / patch releases of different components. I think the best I can offer right now is that we could add warnings like that here in source control and we could add visual warnings in the relevant places in https://lightgbm.readthedocs.io/en/latest/R/reference/. |
I am sad to see this method for passing parameters be removed! The idea of having parameters passed as a list feels very not-R to me -- for comparison, the other modeling libraries I use daily take top-level named arguments (ranger https://rdrr.io/cran/ranger/man/ranger.html ) or a combination of top-level named arguments and While in my ideal world LightGBM would take after other modeling packages and move parameter arguments to the top-level (though likely unwieldy for a package with this many parameters), having the Assuming that this decision won't be revisited, would it be possible to accept |
Thanks for taking the time to write this up @mikemahoney218 !
You're correct, this decision won't be revisited. Support for
As noted in this PR's description, That said, we would welcome a feature request (in a separate issue, please) describing an alternative interface and explaining, with specific code examples, why that interface would be valuable for you and other users. There is precedent for this in LightGBM already....this project's Python package contains a function LightGBM/python-package/lightgbm/engine.py Lines 25 to 42 in 798dc1d
and also a wrapper around that interface which provides a LightGBM/python-package/lightgbm/sklearn.py Lines 573 to 579 in 798dc1d
Thanks for noting this! I'll open a separate issue, to keep the conversation here focused on the specific topic of removing |
This work is complete. See the linked pull requests for more details. For those looking to discuss an alternative interface to LightGBM that does not require creating a list of parameters, please contribute to the conversation in #4295. #4295 (comment) offers a hint at what this project might offer in the future in terms of alternative interfaces for R. |
This issue has been automatically locked since there has not been any recent activity since it was closed. |
Question
I'm opening this request for comment (RFC) to get feedback on the following proposal, originally mentioned in #4202 (comment).
This would apply to:
lgb.cv()
lgb.Dataset()
lgb.Dataset.create.valid()
lgb.train()
lightgbm()
Description
LightGBM's core library supports many parameters, documented at https://lightgbm.readthedocs.io/en/latest/Parameters.html. The exported functions in
{lightgbm}
(the R package), support at least 3 different ways to pass values for these parameters.params
...
For example, the following calls to
lightgbm::lightgbm()
are all equally valid ways to say "perform 14 boosting rounds".Motivation
pros
cons
...
behaviorReferences
{catboost}
does not support passing parameters through...
: https://github.com/catboost/catboost/blob/80fa998c355fb9e5e937893e8b7d67286352965c/catboost/R-package/R/catboost.R#L1478{xgboost}
supports passing parameters through...
: https://github.com/dmlc/xgboost/blob/8760ec48277b345aaaa895b82570c25566fc0503/R-package/R/xgb.train.R#L265params
list might be made easier in the future by implementing the proposal in [R-package] Add function to generate a list of parameters #4195{treesnip}
's current LightGBM integration: https://github.com/curso-r/treesnip/blob/bf27cd871b7fb663a76818f66ea0a5f9bf09f444/R/lightgbm.R#L208, although I think that that package could be patched in a way that's compatible with and without this behaviorThe text was updated successfully, but these errors were encountered: