microsoft / LightGBM

A fast, distributed, high performance gradient boosting (GBT, GBDT, GBRT, GBM or MART) framework based on decision tree algorithms, used for ranking, classification and many other machine learning tasks.
https://lightgbm.readthedocs.io/en/latest/
MIT License
16.38k stars 3.81k forks source link

A bug in ResetGoss #1192

Closed Zibi789 closed 6 years ago

Zibi789 commented 6 years ago

There is a bug in ResetGoss (file boosting/goss.hpp), lines 77 and 78. The buggy case is here:

gbdt_config_->top_rate is 0.1
gbdt_config_->other_rate is 0.2
num_data_ is 3

Then bag_data_cnt is 0, and new Dataset(bag_data_cnt) generates an error message informing that bag_data_cnt must be > 0. The simplest way to fix it is to add this line after line 77:

bag_data_cnt = std::max(1, bag_data_cnt);

And then it is necessary to add the header file algorithm

guolinke commented 6 years ago

@Zibi789 thanks very much! Would you like to create a PR to fix it ?

Zibi789 commented 6 years ago

Yes, I can. How can I push a branch to LightGBM? It seems that I need a permission to do it.

chivee commented 6 years ago

@Zibi789 , you can fork into your own repo, fix the bug and send it back though https://github.com/Microsoft/LightGBM/compare