Closed lostpinky closed 10 months ago
Thanks for using LightGBM.
Can you please provide the information that was asked for when you clicked New Issue
?
lightgbm
are you running?lightgbm
?If you can provide that information, someone here will help you when we have time.
Also note... I've reformatted your post to make the difference between code, output from code, and your own words clearer. If you're unsure how I did that, please see https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax.
@jameslamb Thank you for your prompt response. I have provided all the requested information and look forward to your further response.
I believe the reason is that all models are sharing the same callback objects, which get modified in-place. You should assign each model their own callbacks, i.e. move this line:
callbacks = [log_evaluation(period=100), early_stopping(stopping_rounds=300)]
inside the loop
lgb_model = lgb.train(params,
train_set,
valid_sets=[train_set,val_set],
num_boost_round=10000,
callbacks=[log_evaluation(period=100), early_stopping(stopping_rounds=300)]
)
This issue has been automatically closed because it has been awaiting a response for too long. When you have time to to work with the maintainers to resolve this issue, please post a new comment and it will be re-opened. If the issue has been locked for editing by the time you return to it, please open a new issue and reference this one. Thank you for taking the time to improve LightGBM!
I trained my mode like this:
But the log is not what I want:
The number of early stopping iterations cannot be exactly the same across all folds. I don't know the reason for this. Then I tried another approach to implement early stopping. I used the
early_stopping_rounds
parameter instead of a callback. And this worked well.The early stopping iteration counts are no longer the same for each fold.I want to understand what caused this, and whether it's because there's a bug in the early stopping callback function.
More information: