-
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
[R-package] Disabled early stopping when using 'dart' boosting strategy #2443
Conversation
@jameslamb Please see this my comment. |
@StrikerRUS apologies, I actually meant to address that comment in PR description. What do you think should be done? Since users are just passing in functions to Are you just suggesting that I invoke this warning WHENEVER someone uses |
b0dcce4
to
35680df
Compare
@jameslamb In my comment from the original issue I meant that this fix covers the case when user passes
LightGBM/R-package/R/callback.R Line 386 in 1f88721
maybe somehow use this information? |
@jameslamb @StrikerRUS From what I read, is it |
@jameslamb @Laurae2 Maybe simply move the check into the callback function as it was done for Python-package? https://github.com/microsoft/LightGBM/pull/1895/files |
to your @StrikerRUS 's comment...yes I could add that and am happy to, but As far as pushing the logic down into |
Ah, I didn't know that!
I don't think that someone would write a custom callback for early stopping, since we already have early stopping callback. Even if one will, they will use our implementation as a reference and will see the prohibition of using early stopping with the |
I don't think that known issue was a mistake, maybe you just meant something different than what I thought. We do have a keyword argument So our approach right now is to say "you can enable early stopping by passing I think for now it would be sufficient to add the check using |
@jameslamb Nope, I thought right about documenting functions in |
Ok then yes, I misinterpreted what you meant. Documenting would also mean exporting. This is one of those things where R and Python are really different...in R you have to explicitly declare things as exported to make them usable. I'll update the language in #1143 to say "export callback functions" if that's alright. |
35680df
to
2049df4
Compare
Ok @Laurae2 @StrikerRUS whenever you have time, could you take another look? I've added protection against I still left this in |
I think that then this is another issue, even more feature request. But anyway, it's not related to pkgdown issue. I'll remove it from that list. Can you please create a separate issue for exporting callback functions? |
|
@jameslamb I'm sorry, but could you please explain what is wrong with the following try to mimic Python solution on [pseudo?]R? https://www.diffchecker.com/LylbJ8EG |
I have never seen diffchecker.com before, super cool! In my opinion, this code proposed in your link is going to be difficult to debug and reason about. It's relying on a flag called So in my opinion while my proposal in this PR feels more tedious, it is also more obvious and easier to debug / change. I made that choice partially because I just feel it is a better design for the R package, but also partially because I am not so familiar with all of the R code package code that I could know the full implications of doing something like you proposed. I will defer to @Laurae2 (who understand the internals of the R package more thoroughly) though. If @Laurae2 prefers something like the way this was handled in the Python package and pseudocode in your in link here, I'll happily change the approach from this PR and push the logic down into edit: fixed incorrect use of "call stack" in my original comment |
@jameslamb Thanks a lot for your explanation! |
cab2bcd
to
647f0e9
Compare
I just rebased this to current |
I just rebased this to latest |
647f0e9
to
7ac01c0
Compare
@jameslamb As you pointed out there's a lot of things in common in Ideally in the future we should be able to merge all the duplicate code in one, but it requires rewriting the R package. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some minor suggestions.
376b4dc
to
2128ece
Compare
I've rebased to |
0ecebe1
to
2d230ff
Compare
2d230ff
to
7c2c704
Compare
Ok this has been rebased to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, except two actually unresolved comments about grammar from #2443 (review).
ah! ok fixing |
Co-Authored-By: Nikita Titov <[email protected]>
Co-Authored-By: Nikita Titov <[email protected]>
…nto dart_early_stopping
Thank you for the reviews everyone! I am going to merge this once CI is done. |
was getting this on
Restarting that task after waiting a few minutes seemed to solve it, but something to keep an eye on I guess. |
Yeah, I see this error very often. And |
See discussion in #1893 for background. In this PR, I propose disabling early stopping when the user chooses
'dart'
boosting. The same change was made in the Python package in #1895 .This PR also adds the additional early stopping alias that was added in #2431 .
While working on this piece of code, I refactored it to make it a bit more obvious what is happening. I found that the same code is copied in
lgb.cv()
andlgb.train()
. I think this duplication could lead to inconsistencies in the future, but I considered reducing that duplication out of scope.