Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
勾配ブースティングについて調べてみた ~XGBoostの理論~
Search
NearMeの技術発表資料です
PRO
September 01, 2023
900
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
勾配ブースティングについて調べてみた ~XGBoostの理論~
NearMeの技術発表資料です
PRO
September 01, 2023
More Decks by NearMeの技術発表資料です
See All by NearMeの技術発表資料です
AIエージェントのための 隔離された安全なインフラ設計
nearme_tech
PRO
0
23
Claude Code × git worktree で並列開発 (続き) -差分のサービスだけを併設する-
nearme_tech
PRO
1
69
Claude Code × git worktree で並列開発 — サブモジュール構成のリポジトリで成立させる —
nearme_tech
PRO
0
79
LLM + 強化学習
nearme_tech
PRO
0
37
PosthogのA/Bテスト機能の紹介
nearme_tech
PRO
1
110
AIフレンドリーなプロダクトに向けて
nearme_tech
PRO
2
71
初めてのLean言語
nearme_tech
PRO
0
110
Apache Airflow Workflow orchestration without turning cron into spaghetti
nearme_tech
PRO
2
50
実務で役立つ幾何学 ボロノイ図の基礎から グラフ・ネットワーク応用まで
nearme_tech
PRO
1
93
Featured
See All Featured
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
430
Visualization
eitanlees
153
17k
It's Worth the Effort
3n
188
29k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1.1k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.9k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
570
What does AI have to do with Human Rights?
axbom
PRO
1
2.5k
Design in an AI World
tapps
1
350
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
Raft: Consensus for Rubyists
vanstee
142
7.8k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
630
Building Better People: How to give real-time feedback that sticks.
wjessup
371
20k
Transcript
0 勾配ブースティングについて調べてみた ~ XGBoostの理論 ~ 2023-08-25 第57回NearMe技術勉強会 Mio Takakuwa
1 目次 1. 勾配ブースティング木の概要 2. XGBoostの理論
2 勾配ブースティング決定木とは Gradient boosting decision tree(GBDT) 有名なフレームワーク ◦ XGBoost (2014):
eXtreme Gradient Boosting (全ての葉を分岐) ◦ LightGBM(2016): Light Gradient Boosting Machine (情報利得が大きいものだけ分岐) 決定木 + アンサンブル学習 + 勾配降下法 https://lightgbm.readthedocs.io/en/stable/Features.html
3 Gradient boosting decision tree(GBDT)とは 特徴量:(例) • 年齢:10才 • 性別:女
• 親の身長:160cm • 健康状態:良好 • 運動習慣:週2回 予測する値: 身長:136cm(実際) 決定木 性別 年齢<14 年齢<18 親の身長>178 推定値:130cm
4 Gradient boosting decision tree(GBDT)とは 特徴量:(例) • 年齢:10才 • 性別:女
• 親の身長:160cm • 健康状態:良好 • 運動習慣:週2回 予測する値: 身長:136cm(実際) ランダムフォレスト 推定値:130cm 推定値:133cm 推定値:135cm 平均して... 推定値:133cm
5 Gradient boosting decision tree(GBDT)とは 特徴量:(例) • 年齢:10才 • 性別:女
• 親の身長:160cm • 健康状態:良好 • 運動習慣:週2回 予測する値: 身長:136cm(実際) GBDT 推定値: 130cm 推定値: 135cm 正解はあと6cm 高いなー 推定値: 139cm 推定値: 136cm 正解はあと3cm 低いなー 当たった!
6 XGBoost:Gradient Tree Boosting
7 やりたいこと ・ ・ ・ t-1 個の モデル t 個目の
モデル (作成済み) (作りたい) 精度の高い t-1 個のモデル(決定木)を用いて、 実際の値と予測値の差が小さくなるような t 個目のモデルを作りたい 方針: t 個目のモデル決定時の 損失関数(実際の値と予測値のズレ) をt-1 個のモデル等を用いて表現し、 最小化する ・ ・
8 ツリーモデルの定義 ツリーアンサンブルモデル ツリーアンサンブルモデル(予測値)の出力 記号 https://xgboost.readthedocs.io/en/stable/tutorials/model.html
9 ツリーモデルの定義 ツリーアンサンブルモデル(予測値)の出力(前頁) 葉の index 1 2 3 4 葉の
出力値 w 1 w 2 w 3 ω 4 input x 0 qとωのイメージ output index:3 出力値:ω 3 ex. 記号
10 損失関数 λ=0なら従来の 勾配ブースティングと 同じらしい...
11 やりたいこと ・ ・ ・ t-1 個の モデル t 個目の
モデル (作成済み) (作りたい) 精度の高い t-1 個のモデル(決定木)を用いて、 実際の値と予測値の差が小さくなるような t 個目のモデルを作りたい 方針: t 個目のモデル決定時の 損失関数(実際の値と予測値のズレ) をt-1 個のモデル等を用いて表現し、 最小化する ・ ・ ・
12 t個目の損失関数の最小化 1項目に関して、2次のテイラー展開をすると、 ここで次のように表記する (決定木)を調節して、 損失関数を小さくしたい
13 t個目の損失関数の最小化 定数項は最小化に関係ないので無視 損失関数の定義 テイラー展開 (前ページ最後の式) この式の最小化のため、式を変形していく 決定木 葉の出力値
14 t個目の損失関数の最小化 葉のindex (j) 1 2 3 4 データの集合 I
1 I 2 I 3 I 4 葉の出力値 葉のindexがjの葉に入っているデータの集合を とする ex. 3番目の葉に x 2 ,x 5 , x 6 が 入っているなら、 I 3 = {2, 5, 6} ‥T ‥ x 1 ,x 3 x 4 x 7 ,x 9 x 12 x 2 ,x 5 x 6 x 8 ,x 10 x 11 x 1 ~ x 12
15 t個目の損失関数の最小化 全データ一度に足しあげる ↓ 葉の中の和を出した後、 それぞれを足す ツリーアンサンブル モデルの定義 葉の出力値の2乗和
16 のg i , h i は, (損失関数の1, 2次の勾配) t-1
個の決定木の結果(予測値)と実際の値から計算可能 t個目の損失関数の最小化 損失関数を最小にする t 個目の決定木の葉j が返すべき結果
17 XGBoostのGBDT | やりたいこと ・ ・ ・ t-1 個の モデル
t 個目の モデル (作成済み) (作りたい) 精度の高い t-1 個のモデル(決定木)を用いて、 実際の値と予測値の差が小さくなるような t 個目のモデルを作りたい ・ ・ 木の構造q(x)が固定の場合: XGBoostの最適解の近似値
18 参考文献 • LightGBM documentation: https://lightgbm.readthedocs.io/en/stable/ • LightGBMの論文:Guolin Ke et
al., “LightGBM: a highly efficient gradient boosting decision tree”, 2017, (https://dl.acm.org/doi/10.5555/3294996.3295074) • XGBoostのdocumentation: https://xgboost.readthedocs.io/en/stable/tutorials/model.html • XGBoostの論文:Tianqi Chen et al. “XGBoost: A Scalable Tree Boosting System” https://arxiv.org/abs/1603.02754 • 参考になる記事 ◦ https://kefism.hatenablog.com/entry/2017/06/11/182959 ◦ https://qiita.com/kenmatsu4/items/226f926d87de86c28089 ◦ https://qiita.com/triwave33/items/aad60f25485a4595b5c8
19 Thank you