Menu
Sign In Search Podcasts Charts People & Topics Add Podcast API Pricing
Podcast Image

知能情報研究室ラジオ

【パターン認識ラジオ】回帰(予測)問題を決定木で

07 Aug 2023

Description

🌞🎵 こんにちは、パターン認識ラジオのリスナーの皆さま!夏のビーチに波音を背景に、今日は「回帰問題の決定木とランダムフォレスト」の爽やかな話題で涼む時間となりました!   🍧 **さらにリッチな例題**: 皆さま、ビーチでアイスクリームを販売する場面を思い浮かべてください。ただし、気温だけでなく、天気や曜日、さらにはビーチでのイベントの有無もアイスクリームの販売数に影響しています。   🌤 天気: 曇り=0, 晴れ=1 🗓 曜日: 月=0, 火=1, 水=2 ... 日=6 🎉 イベント: 無し=0, 有り=1   🍨 **Pythonでの決定木**:   ```python import numpy as np from sklearn.tree import DecisionTreeRegressor   # 仮のデータ (気温、天気、曜日、イベント と アイスクリームの販売数) X = np.array([     [22, 0, 0, 0],     [24, 1, 1, 0],     [26, 1, 2, 1],     [28, 1, 3, 0],     [30, 0, 4, 1],     [32, 1, 5, 0],     [34, 0, 6, 1] ]) sales = np.array([50, 65, 80, 85, 90, 100, 105])   # 決定木の訓練 tree = DecisionTreeRegressor(max_depth=3) tree.fit(X, sales)   # 予測 (31度、晴れ、土曜日、イベントありの場合) predict_data = np.array([[31, 1, 5, 1]]) predicted_sales = tree.predict(predict_data)   print(f"予測される販売数: {predicted_sales[0]}個") ```   🌴 **ランダムフォレストでさらに詳細に!**:   ```python from sklearn.ensemble import RandomForestRegressor   # ランダムフォレストの訓練 forest = RandomForestRegressor(n_estimators=10) forest.fit(X, sales)   # 予測 predicted_sales_forest = forest.predict(predict_data)   print(f"ランダムフォレストによる予測される販売数: {predicted_sales_forest[0]}個") ```   🏄‍♂️ まとめ: ビーチのアイスクリーム売り場で、天気や曜日、イベントまで考慮して販売数を予測!データの力で、この夏を最高の夏にしましょう!そして、サンブロックは必須ですよ!🍦🌊 🌴 **GBDTでさらに風味豊かに!**:   GBDTは、決定木を順番に学習させ、それぞれの決定木が前の決定木の誤りを修正するように動作します。一つ一つの決定木は弱学習器として働き、合わせることで強力なモデルを形成します。   ```python from sklearn.ensemble import GradientBoostingRegressor   # GBDTの訓練 gbdt = GradientBoostingRegressor(n_estimators=100, learning_rate=0.1, max_depth=3) gbdt.fit(X, sales)   # 予測 predicted_sales_gbdt = gbdt.predict(predict_data)   print(f"GBDTによる予測される販売数: {predicted_sales_gbdt[0]}個") ```   🌊 **まとめ**:   ビーチでのアイスクリーム販売、一度の予測だけでは不十分?そんな時は、ランダムフォレストやGBDTを駆使して、精度の高い予測を目指しましょう!そして、ビーチバレーの後はしっかりとアイスクリームを楽しんで、夏の日を満喫しましょう!   告知リンク: https://www.youtube.com/playlist?list=PLPiQ8tB0Q233SUXcAh_FkCzNS51aN48Ud https://youtu.be/gP7jjWApgHA https://www.kogakuin.ac.jp/science/ https://www.kogakuin.ac.jp/admissions/event/oc.html https://wcci2024.org/

Audio
Featured in this Episode

No persons identified in this episode.

Transcription

This episode hasn't been transcribed yet

Help us prioritize this episode for transcription by upvoting it.

0 upvotes
🗳️ Sign in to Upvote

Popular episodes get transcribed faster

Comments

There are no comments yet.

Please log in to write the first comment.