nyaggle icon indicating copy to clipboard operation
nyaggle copied to clipboard

Support lgb.cv and xgb.cv for cross-validation

Open nyanp opened this issue 5 years ago • 2 comments

Unlike the current implementation of cv in nyaggle, The models trained in lgb.cv and xgb.cv have an equal number of trees in all folds.

Since these “balanced” models may work better when the number of data is small, we sometimes want to extract the trained models from lgb.cv or xgb.cv and use them for test data.

So it would be useful to have the option to use these cv functions in nyaggle's run_experiment and cross_validate as well.

ref: https://blog.amedama.jp/entry/lightgbm-cv-model https://blog.amedama.jp/entry/xgboost-cv-model

nyanp avatar Jun 14 '20 23:06 nyanp

PR がマージされたので、おそらく次のリリースから lightgbm.cv() 関数に return_cvbooster オプションが追加されて、謎のコールバックを使わなくても学習済み Booster が取得できるようになるよ。

https://twitter.com/momijiame/status/1290078465333444609

wakame1367 avatar Aug 03 '20 01:08 wakame1367

Features seem to have been merged in lightgbm v3.0.0.

[python] add return_cvbooster flag to cv func and publish _CVBooster (#283,#2105,#1445) @momijiame (#3204)

https://github.com/microsoft/LightGBM/releases/tag/v3.0.0

wakame1367 avatar Sep 01 '20 04:09 wakame1367