averagePathLengthFromRoot

src/Utils.js

Returns the average path length of the nodes in a tree from the root given the number of training data points

averagePathLengthFromRoot(sizeDataset: number): any
Parameters
sizeDataset (number) the number of data training points
Returns
any: the average path length from the root

constructor

src/TreeNode.js

Constructor for a tree node used in an isolation forest

new constructor(options: object)
Parameters
options (object) options for the TreeNode
Name Description
options.depth number the depth of the TreeNode
options.maxDepth number the maximum depth possible for the TreeNode

isInnerNode

src/TreeNode.js

Verifies whether the current node is an inner node in the tree it belongs to

isInnerNode(): any
Returns
any: a boolean

Verifies whether the current node is a leaf node in the tree it belongs to

isLeafNode(): any
Returns
any: a boolean

numberDataPoints

src/TreeNode.js

Returns the number of data points in the current node

numberDataPoints(): any
Returns
any: the number of data points

pathLengthFromRoot

src/TreeNode.js

Returns the length of the path from the root to isolate the data point

pathLengthFromRoot(data: Array<number>, currentPathLengthFromRoot: number)
Parameters
data (Array<number>) data point for which to predict the anomaly score
currentPathLengthFromRoot (number) the current path length from the root

Train a node for the isolation forest given the training set

train(trainingSet: any, currentDepth: number)
Parameters
trainingSet (any)
currentDepth (number) depth of the node which is currently trained

Create a new instance of IsolationForest

new constructor(options: object)
Parameters
options (object) options for the IsolationForest
Name Description
options.nEstimators number (default 100) number of trees/estimators to use in the forest

Predict the anomalies in the set

predict(data: any): Array<number>
Parameters
data (any)
Returns
Array<number>: returns the anomaly scores for the data points

Train the trees in the Isolation Forest with the given training set

train(trainingSet: any)
Parameters
trainingSet (any)