バギングのパラメータ:コツとポイント

Pythonで学ぶアンサンブル手法

Román de las Heras

Data Scientist, Appodeal

バギングの基本パラメータ

基本パラメータ
  • base_estimator
  • n_estimators
  • oob_score
    • est_bag.oob_score_
Pythonで学ぶアンサンブル手法

バギングの追加パラメータ

追加パラメータ
  • max_samples: 各推定器で抽出するサンプル数。
  • max_features: 各推定器で抽出する特徴量数。
    • 分類 ~ sqrt(特徴量数)
    • 回帰 ~ 特徴量数 / 3
  • bootstrap: 置換抽出かどうか。
    • True --> max_samples = 1.0
    • False --> max_samples < 1.0
Pythonで学ぶアンサンブル手法

ランダムフォレスト

分類

from sklearn.ensemble import RandomForestClassifier

clf_rf = RandomForestClassifier(
    # parameters...
)

回帰

from sklearn.ensemble import RandomForestRegressor

reg_rf = RandomForestRegressor(
    # parameters...
)

バギングのパラメータ:

  • n_estimators
  • max_features
  • oob_score

木固有のパラメータ:

  • max_depth
  • min_samples_split
  • min_samples_leaf
  • class_weight ("balanced")
Pythonで学ぶアンサンブル手法

バイアス—バリアンスのトレードオフ

バイアス・バリアンス.png

Pythonで学ぶアンサンブル手法

演習に進みましょう!

Pythonで学ぶアンサンブル手法

Preparing Video For Download...