6
$\begingroup$

Is there a R implementation of isolation forest for anomaly detection?

Similar to the implementation from sklearn.

$\endgroup$
8
$\begingroup$

See the iforest package on Sourceforge or on R-Forge:

This package implements an anomaly detection method that detects data-anomalies using binary trees. Using the property that anomalies are more susceptible to isolation, anomalies can be detected as data points which have short expected path lengths.

Isolation Forest detects data-anomalies using binary trees. Platform: R Reference: Fei Tony Liu, Kai Ming Ting, and Zhi-Hua Zhou, “Isolation Forest”, IEEE International Conference on Data Mining 2008 (ICDM 08)

or the isofor package on GitHub:

One efficient way of performing outlier detection in high-dimensional datasets is to use random forests. The isofor ‘isolates’ observations by randomly selecting a feature and then randomly selecting a split value between the maximum and minimum values of the selected feature.

$\endgroup$
2
  • $\begingroup$ Interesting! since both packages are not in CRAN, is there an easy "for dummies" way to install them, at least on a Linux (not OSX) VM ? $\endgroup$
    – guzu92
    Sep 1 '17 at 14:51
  • 3
    $\begingroup$ install devtools (install.packages("devtools")) and then devtools::install_github("Zelazny7/isofor") $\endgroup$
    – rcs
    Sep 1 '17 at 20:39
3
$\begingroup$

Solitude (CRAN / github): Isolation forest is anomaly detection method introduced by the paper Isolation based Anomaly Detection (Liu, Ting and Zhou )

PS: I am the author of this package

$\endgroup$
3
  • $\begingroup$ I think you forgot to export most methods, only isolation_forest is visible $\endgroup$
    – Cos
    Dec 17 '18 at 13:46
  • 1
    $\begingroup$ @Cos predict method exists. This vignette should help. bit.ly/2Qwbs8L $\endgroup$
    – talegari
    Dec 18 '18 at 17:32
  • $\begingroup$ Hi, I just discovered your package when looking up isoforest in R. Thanks for the easy to use implementation. I had a couple of questions for you: Is there a way to access individual trees information? I guess its kept private (the ranger fit)? Also, I see you have set y to a jumbled number (based on number of rows in the data frame)...could you please explain the reasoning for this as it wasnt clear for me. Shouldnt the isoforest run unsupervised? Thanks! $\endgroup$ Aug 19 '20 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.