當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參數,如果小於時,就刪除這個參數。就可以運行了