Isolation trees

Introduction à la détection d’anomalies en R

Alastair Rushworth

Data Scientist

Isolation tree

Introduction à la détection d’anomalies en R

Isolation tree plots

Introduction à la détection d’anomalies en R

Fit an isolation tree

library(isofor)

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

iForest() arguments

  • data - dataframe
  • nt - number of isolation trees to grow

 

 

Package download from https://github.com/Zelazny7/isofor

Introduction à la détection d’anomalies en R

Generate an isolation score

furniture_score <- predict(furniture_tree, newdata = furniture)

predict() arguments

  • object - a fitted iForest model
  • newdata - data to score
Introduction à la détection d’anomalies en R

Interpreting the isolation score

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

Standardized path length

  • Scores between 0 and 1
  • Scores near 1 indicate anomalies (small path length)
Introduction à la détection d’anomalies en R

Let's practice!

Introduction à la détection d’anomalies en R

Preparing Video For Download...