[docs] document CLI behavior when label_column is omitted #4485
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.
Answering this stack overflow question tonight, I wasn't able to figure out from LightGBM's documentation that, when using the CLI, if
label_column
is omitted fromtrain.conf
, LightGBM defaults to using the first column in the training data as the target.I had to figure this out from source code
Dataset.label_idx_
is initialized to 0:LightGBM/src/io/dataset_loader.cpp
Line 22 in a8ee487
Dataset.label_idx_
is only overridden if label_column is provided in the config:LightGBM/src/io/dataset_loader.cpp
Lines 48 to 57 in a8ee487
This PR proposes two small changes to make this clearer for new users of the CLI:
label_column
to all of the training configs inexamples/
, to nudge users who copy those configs as a reference to explicitly definelabel_column
in their own configs