LightGBM.cv时,feature_pre_filter和min_data_in_leaf相互矛盾

当LightGBM.cv时,如果min_data_in_leaf设置的值比默认值(20)小的时候,就会报错:

LightGBMError: Reducing `min_data_in_leaf` with `feature_pre_filter=true` may cause unexpected behaviour for features that were pre-filtered by the larger `min_data_in_leaf`.
You need to set `feature_pre_filter=false` to dynamically change the `min_data_in_leaf`.

在网上查了很多资料,说是要在dataset之前设置feature_pre_filter,但是有的人又说这个参数已经删除了,翻看官网也没有看到很好的解决方法:https://github.com/optuna/optuna/issues/1718

反正我们就默认这个参数feature_pre_filter已经删除了,如果我们调参时min_data_in_leaf 的最佳值大于20时,就可以保留min_data_in_leaf参数,如果小于时,就删除这个参数。就可以运行了

原文地址:https://www.cnblogs.com/cgmcoding/p/14524885.html