[R-package] fix integer categorical features check in lgb.cv (fixes #6412) #6442
+24
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #6412
When creating the folds for cv we slice the dataset, which just calls the constructor passing the same arguments and the
used_indices
. Iffree_raw_data = TRUE
then by the time this constructor is called there isn't raw data anymore, however, we also don't need to check if the categorical feature indices are out of bounds because this has already been checked when constructing the original dataset (and the categorical features can't be changed once the dataset has been constructed).This adds a check to see if we're building a subset and skips the validation. We can rely on that condition because it's checked afterwards
LightGBM/R-package/R/lgb.Dataset.R
Lines 202 to 212 in 6e78e69