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

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

Similar to the implementation from sklearn.

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)

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.

• 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 ? Sep 1 '17 at 14:51
• install devtools (install.packages("devtools")) and then devtools::install_github("Zelazny7/isofor")
– rcs
Sep 1 '17 at 20:39

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

• I think you forgot to export most methods, only isolation_forest is visible
– Cos
Dec 17 '18 at 13:46
• @Cos predict method exists. This vignette should help. bit.ly/2Qwbs8L Dec 18 '18 at 17:32
• 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! Aug 19 '20 at 14:01