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] remove unused argument in early stopping callback #4342

Merged
merged 1 commit into from
Jun 5, 2021

Conversation

jameslamb
Copy link
Collaborator

Noticed tonight that the function returned by cb.early.stop() has an argument finalize = FALSE.

That argument's value is never referenced, and no existing code expects to pass it. This PR proposes removing it.

The places where callbacks are executed only pass a single argument, env:

for (f in cb$pre_iter) {
f(env)
}

for (f in cb$post_iter) {
f(env)
}

for (f in cb$pre_iter) {
f(env)
}

for (f in cb$post_iter) {
f(env)
}

I'm also confident in this change because there are multiple unit tests checking that early stopping works correctly in the R package, for example:

test_that("lgb.train() works with early stopping for classification", {

Notes for Reviewers

This is not a user-facing breaking change because all callbacks are internal to the package (since #2479 is still open).

Copy link
Collaborator

@StrikerRUS StrikerRUS left a comment

Choose a reason for hiding this comment

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

LGTM!

@jameslamb jameslamb merged commit 3837e60 into master Jun 5, 2021
@jameslamb jameslamb deleted the r/unused-arg branch June 5, 2021 12:50
@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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants