Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
フルスクラッチで最強の決定木を実装する
Search
NearMeの技術発表資料です
PRO
December 22, 2023
160
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
フルスクラッチで最強の決定木を実装する
NearMeの技術発表資料です
PRO
December 22, 2023
More Decks by NearMeの技術発表資料です
See All by NearMeの技術発表資料です
PosthogのA/Bテスト機能の紹介
nearme_tech
PRO
1
21
AIフレンドリーなプロダクトに向けて
nearme_tech
PRO
1
50
初めてのLean言語
nearme_tech
PRO
0
76
Apache Airflow Workflow orchestration without turning cron into spaghetti
nearme_tech
PRO
1
21
実務で役立つ幾何学 ボロノイ図の基礎から グラフ・ネットワーク応用まで
nearme_tech
PRO
1
59
SQL/ID抽出タスクから考える 実践的なハルシネーション対策
nearme_tech
PRO
1
67
OpenCode & Local LLM
nearme_tech
PRO
0
200
OpenCode Introduction
nearme_tech
PRO
0
59
【Browser Automation × AI】 Stagehandを試してみよう
nearme_tech
PRO
0
160
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
What does AI have to do with Human Rights?
axbom
PRO
1
2.3k
BBQ
matthewcrist
89
10k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.4k
Typedesign – Prime Four
hannesfritz
42
3.1k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
280
Leo the Paperboy
mayatellez
8
1.9k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
150
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
250
KATA
mclloyd
PRO
35
15k
Transcript
0 2023-12-22 第72回NearMe技術勉強会 Takuma Kakinoue フルスクラッチで最強の決定⽊を実装する
1 はじめに • ⼤きな⽬標 ◦ 最強の決定⽊をフルスクラッチで作る! • 前回まで ◦ ランダムフォレストの実装を⾏った
▪ https://speakerdeck.com/nearme_tech/jue-ding-mu-woshi-zhuang-suru • 今回のスコープ ◦ ⾃作ランダムフォレストの性能評価および改善ポイントの考察
2 性能評価⽅法 • Kaggleの常設の⼊⾨コンテスト「Spaceship Titanic」のデータセットを使う ◦ https://www.kaggle.com/competitions/spaceship-titanic • Spaceship Titanicの主な特徴
◦ チュートリアル問題として有名な「Titanic」の派⽣コンテスト ◦ 本家「Titanic」よりデータ数が多いが,⽋損値も多い • ⾃作RandomForestで学習して性能を評価する ◦ ⾃作RandomForestの実装コード ▪ https://github.com/kakky-hacker/algorithm_sandbox ◦ ⽐較対象は,scikit-learnのRandomForestClassifier ▪ https://github.com/scikit-learn/scikit-learn/tree/main
3 結果 簡単な⽋損値処理とラベルエンコーディングだけを⾏い,学習させた。 ↓ ⾃作RandomForest ↓ scikit-learnのRandomForestClassifier accuracy:0.77951 accuracy:0.78606
4 考察 scikit-learnのRandomForestにaccuracyで 0.6% ほど負けてしまった。 ただ,アルゴリズムの実装⾃体は問題なくできてそう。 結果に対する考察 • ⾃作RandomForestは計算速度が圧倒的に遅かった(数100倍レベル) ◦
よって,⽊の数や深さをそこまで拡張できなかったので若⼲精度が下がった可能性 今後の展望 • 計算速度を上げる⼯夫をする ◦ 計算が重い処理の特定および改善 • Borutaなどの特徴量選択アルゴリズムを導⼊ ◦ 実装済みではあるが,現状,計算速度がネックとなって,使えていない • 勾配ブースティングを導⼊ ◦ ブースティングの仕組みを理解し実装
5 計算速度の改善ポイント 右のコードは,エッジの最適な分岐を 算出する関数である。 全特徴量に対して,ユニークな値全て を順番に調べているので⾮効率。 ↓ scikit-learnのソースコードを 解析して,知⾒を得る。 https://github.com/kakky-hacker/algorithm_sandbox/blob/main/decision_tree/core.py
6 Thank you