Isolation Forest のハイパーパラメータ概要

Anomaly Detection in Python

Bekhruz (Bex) Tuychiev

Kaggle Master, Data Science Content Creator

重要なハイパーパラメータ

IForest に最も影響するハイパーパラメータ:

  • contamination
  • n_estimators
  • max_samples
  • max_features
Anomaly Detection in Python

contamination とは?

IForest がデータ点を分類する流れ:

  1. 生の異常スコアを算出
  2. contamination という閾値を設定
  3. contamination に相当する上位割合のスコアを外れ値として選択
Anomaly Detection in Python

contamination の設定

from pyod.models.iforest import IForest


# 0~0.5 の値を受け付ける iforest = IForest(contamination=0.05)
Anomaly Detection in Python

n_estimators とは?

# 大規模データには木を増やす
iforest = IForest(n_estimators=1000)

iforest.fit(airbnb_df)
Anomaly Detection in Python

max_samples と max_features

iforest = IForest(n_estimators=200, max_samples=0.6, max_features=0.9)


iforest.fit(airbnb_df)
Anomaly Detection in Python

木の成長

  • iTree:
    • ランダムに成長
    • 分割は特徴量の最小~最大の間でランダム
    • 次で停止:
      • すべての点が分離
      • 最大深さに到達
Anomaly Detection in Python

最大木深

  • サンプルサイズの対数に等しい
Anomaly Detection in Python

IForest の利点

  • 大規模データで非常に高速
  • 他手法のように正常データの網羅を不要
  • 統計的仮定が不要
  • 既定設定で良好に動作
Anomaly Detection in Python

外れ値検知の課題

  • 教師あり学習は RMSE や log loss などの指標に依存
  • 外れ値検知は教師なし学習の課題
  • 外れ値分類器は教師ありモデルと組み合わせるべき
Anomaly Detection in Python

¡Vamos a practicar!

Anomaly Detection in Python

Preparing Video For Download...