アイソレーションツリー

Rで学ぶ異常検知入門

Alastair Rushworth

Data Scientist

アイソレーションツリー

Rで学ぶ異常検知入門

アイソレーションツリーの可視化

Rで学ぶ異常検知入門

アイソレーションツリーを学習

library(isofor)

furniture_tree <- iForest(data = furniture, nt = 1)

iForest() の引数

  • data - データフレーム
  • nt - 生成するアイソレーションツリー数

 

 

パッケージの入手先: https://github.com/Zelazny7/isofor

Rで学ぶ異常検知入門

アイソレーションスコアの生成

furniture_score <- predict(furniture_tree, newdata = furniture)

predict() の引数

  • object - 学習済み iForest モデル
  • newdata - スコアリング対象データ
Rで学ぶ異常検知入門

アイソレーションスコアの解釈

furniture_score[1:10]
[1] 0.5820092 0.5820092 0.5439338 0.5820092 0.5439338 
[6] 0.5820092 0.7129862 0.5363547 0.5363547 0.5363547

標準化パス長

  • スコアは 0〜1
  • 1 に近いほど異常(パスが短い)
Rで学ぶ異常検知入門

練習しましょう!

Rで学ぶ異常検知入門

Preparing Video For Download...