You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Isolation Forest is an unsupervised learning algorithm that is able to detect anomalies (data patterns that differ from normal instances). Detection is performed by recursive data partitioning, which can be represented by a tree structure. At each iteration data is splitted using randomly chosen feature and its value (random number between maximum and minimum value of chosen feature). Due to the fact that anomalies are rare and different from other instances, smaller number of partitions is needed to isolate them. This is equivalent to the path length in created tree. Shorter path means that given instance can be an anomaly. To improve accuracy the ensemble of such trees is created and result is averaged over all trees.
13
+
14
+
To get more information about algorithm, please refer to this paper: [IFOREST](https://cs.nju.edu.cn/zhouzh/zhouzh.files/publication/icdm08b.pdf).
15
+
16
+
## Installation
17
+
18
+
go get -u github.com/e-XpertSolutions/go-iforest
19
+
20
+
## Usage
21
+
22
+
This example shows how to use the Isolation Forest. You will need to load the data, initialize iforest with proper parameters and use two functions: Train(), Test() to create the model. First one is used to build the trees, second one to find proper "anomaly threshold" and detect anomalies in given data. After that you can pass new instances to Predict() which result in labeling them as normal "0" or anomaly "1".
23
+
It is possible to use parallel versions of testing and detecting functions - they use multiple go routines to speed up computations.
24
+
Created models can be saved and read from the files using Save() and Load() methods.
25
+
26
+
```go
27
+
package main
28
+
29
+
import(
30
+
"fmt"
31
+
"github.com/e-XpertSolutions/go-iforest/iforest"
32
+
)
33
+
34
+
funcmain(){
35
+
36
+
// input data must be loaded into two dimensional array of the type float64
37
+
// please note: loadData() is some custom function - not included in the
0 commit comments