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] exclude training data from being checked for early stopping #2472

Closed
StrikerRUS opened this issue Sep 29, 2019 · 2 comments · Fixed by #2961
Closed

[R-package] exclude training data from being checked for early stopping #2472

StrikerRUS opened this issue Sep 29, 2019 · 2 comments · Fixed by #2961

Comments

@StrikerRUS
Copy link
Collaborator

Check all datasets in validation list for early stopping excluding the training data to match the Python-package behavior:

Early stopping requires at least one set in valid_sets. If there is more than one, it will use all of them except the training data:
https://github.com/microsoft/LightGBM/blob/master/docs/Python-Intro.rst#early-stopping

Refer to #2371.
Python code:

if ((env.evaluation_result_list[i][0] == "cv_agg" and eval_name_splitted[0] == "train"
or env.evaluation_result_list[i][0] == env.model._train_data_name)):
_final_iteration_check(env, eval_name_splitted, i)
continue # train data for lgb.cv or sklearn wrapper (underlying lgb.train)

C++ code:

LightGBM/src/io/config.cpp

Lines 237 to 248 in 5c0daca

if (valid_data_initscores.empty()) {
std::vector<std::string> new_valid;
for (size_t i = 0; i < valid.size(); ++i) {
if (valid[i] != data) {
// Only push the non-training data
new_valid.push_back(valid[i]);
} else {
is_provide_training_metric = true;
}
}
valid = new_valid;
}

@StrikerRUS
Copy link
Collaborator Author

Closed in favor of being in #2302. We decided to keep all feature requests in one place.

Welcome to contribute this feature! Please re-open this issue (or post a comment if you are not a topic starter) if you are actively working on implementing this feature.

@jameslamb
Copy link
Collaborator

this was fixed in #2961

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants