Learn R Programming

isotree (version 0.5.14)

isotree.build.indexer: Build Indexer for Faster Terminal Node Predictions and/or Distance Calculations

Description

Builds an index of terminal nodes for faster prediction of terminal node numbers (calling `predict` with `type="tree_num"`).

Optionally, can also pre-calculate terminal node distances in order to speed up distance calculations (calling `predict` with `type="dist"` or `type="avg_sep"`).

Usage

isotree.build.indexer(model, with_distances = FALSE)

Arguments

model

An Isolation Forest model (as returned by function isolation.forest) for which an indexer for terminal node numbers and/or distances will be added.

The object will be modified in-place.

with_distances

Whether to also pre-calculate node distances in order to speed up `predict` with `type="dist"` or `type="avg_sep"`. Note that this will consume a lot more memory and make the resulting object significantly heavier.

Value

The same `model` object (as invisible), but now with an indexer added to it. Note the input object is modified in-place regardless.

Details

This feature is not available for models that use `missing_action="divide"` or `new_categ_action="weighted"` (which are the defaults when passing `ndim=1`).

See Also

isotree.drop.indexer