LoginSignup
1
1

More than 3 years have passed since last update.

LightGBMTunerの処理を覗いてみる

Last updated at Posted at 2020-02-18

はじめに

昨年9月末のPyData.Tokyoでの発表で紹介されていたLightGBMTunerがついに実装された。

LightGBMに限らず、モデルのパラメーターは独立ではなく相互に作用し合っている。
そのため、パラメーターチューニング時には各パラメーターを段階的にチューニングした方が高い精度を期待できる。
影響が大きい(と思われる)パラメーターから順にチューニングしていくというのがコンセプト。

確認環境

  • Windows10
  • Python 3.7
  • optuna 1.0.0

処理内容


実装はこちら

No. 内容 メソッド名  パラメーター名 チューニング範囲 試行回数
1 feature_fraction(1回目) tune_feature_fraction() feature_fraction 0.4~1.0 7回
2 num leaves tune_feature_fraction() num leaves 0~1(optuna.samplers.TPESampler使用) 20回
3 bagging tune_bagging() bagging_fraction, bagging_freq 0~1(optuna.samplers.TPESampler使用) 10回
4 feature_fraction(2回目) tune_feature_fraction_stage2() feature_fraction 1回目の最適値±0.08の範囲(0.4~1.0の範囲から外れる値は除く) 3~6回
5 regularization tune_regularization_factors() lambda_l1, lambda_l2 0~1(optuna.samplers.TPESampler使用) 20回
6 min data in leaf tune_min_data_in_leaf() min_child_samples 5, 10, 25, 50, 100 5回

気になった点としては以下の通り。

  • feature_fractionを2段階でチューニングしている効果は?
  • num leavesより先にfeature_fractionなの?
  • lambda_l1、lambda_l2のチューニングが0~1と狭め(今まで最大値100まで取ってたが広げ過ぎ?)

好みに合わせてチューニング内容を変更したい場合、現状ではモンキーパッチでrun()を実装する必要がある。

補足

もしパラメーターの意味合いが分からなければ、下記リンクで気持ちを理解してあげるところから始める。
勾配ブースティングで大事なパラメータの気持ち - nykergoto’s blog

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1