# isanomaly

## Syntax

## Description

finds anomalies in the table `tf`

= isanomaly(`forest`

,`Tbl`

)`Tbl`

using the `RobustRandomCutForest`

model object `forest`

and returns the
logical array `tf`

, whose elements are `true`

when an
anomaly is detected in the corresponding row of `Tbl`

. You must use this
syntax if you create `forest`

by passing a table to the `rrcforest`

function.

specifies options using one or more name-value arguments in addition to any of the input
argument combinations in the previous syntaxes. For example, set
`tf`

= isanomaly(___,`Name=Value`

)

to identify observations with
scores above 0.5 as anomalies.`ScoreThreshold`

=0.5

## Examples

## Input Arguments

## Output Arguments

## More About

## Algorithms

`isanomaly`

considers `NaN`

, `''`

(empty character vector), `""`

(empty string), `<missing>`

, and `<undefined>`

values in `Tbl`

and `NaN`

values in `X`

to be missing values.

`isanomaly`

uses observations with missing values to find splits on
variables for which these observations have valid values. The function might place these
observations in a branch node, not a leaf node. Then `isanomaly`

computes the ratio (`Disp`

(*x*,*C*)/|*C*|) by traversing from the branch node to the root node for each tree. The
function places an observation with all missing values in the root node. Therefore, the
ratio and the anomaly score become the number of training observations for each tree, which
is the maximum possible anomaly score for the trained robust random cut forest model. You
can specify the number of training observations for each tree by using the `NumObservationsPerLearner`

name-value argument.

## References

[1] Guha, Sudipto, N. Mishra, G. Roy, and O. Schrijvers. "Robust Random Cut Forest Based Anomaly Detection on Streams," *Proceedings of The 33rd International Conference on Machine Learning* 48 (June 2016): 2712–21.

[2] Bartos, Matthew D., A. Mullapudi, and S. C. Troutman. "rrcf: Implementation of the Robust Random Cut Forest Algorithm for Anomaly Detection on Streams." *Journal of Open Source Software* 4, no. 35 (2019): 1336.

## Extended Capabilities

## Version History

**Introduced in R2023a**