Closed kevinorjohn closed 3 years ago
is_unbalance
and scale_pos_weight
are designed for the objective function, so this behavior is expected.
In most use cases, we don't want to change the distribution of evaluation data.
If you want to change the distribution, you can directly use the sample weights as in your script.
Ok, I got it. Let me close this issue.
This issue 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.
How you are using LightGBM?
LightGBM component: Python package
Environment info
Operating System: macOS Catanila 10.15.6
CPU/GPU model: CPU
Python version: 3.7.0
LightGBM version or commit hash: 3.1.1
Error message and / or logs
Reproducible example(s)
Description
The parameter of
is_unbalance
would not properly assign label_weight for the evaluation. In the example, there is an unbalanced dataset with 10% positive instances and 90% negative instances. First, I setis_unbalance
to True and got the training binary log loss of 0.0765262 and the test binary log loss of 0.0858548. However, if I directly assigned sample weights into the dataset, I got the different training/test binary log loss of 0.206785 and 0.222888 respectively. I expectis_unbalance
would assign sample weights for both the objective function and the evaluation metric. But it seems that this parameter would only affect optimization objectives.