ALSO_RF: Attribute-wise Learning for Scoring Outliers (ALSO) with...

Description Usage Arguments Details Value References Examples

View source: R/ALSO.R

Description

Attribute-wise Learning for Scoring Outliers (ALSO) with Random Forest.

Usage

1
ALSO_RF(data, cross_validate = TRUE, n_folds = 5, scores_only = TRUE, ...)

Arguments

data

a data.frame, tibble, or numeric matrix

cross_validate

logical, if TRUE then use k-fold cross-validation for scoring

n_folds

an integer specifying the number of folds if cross_validate = T. Defaults to 5

scores_only

logical, if TRUE return outlier scores only. If FALSE return a list with additional output (see return)

...

additional arguments passed to the modeling function

Details

ALSO_RF() uses random forests (from the ranger package) to compute a number of regressors/classifiers equal to the number of columns in the input dataset. Random forest models are chosen for this method due to their flexibility (use for classification and regression) and robustness. Outlier scores for each observation are determined by computing the aggregate errors from the individual models.

Feature weights are critical in determining outlier scores. Features with high RMSE are given less weight than features with lower RMSE. The adjusted feature weights are found by subtracting the feature RMSE from 1.Feature RMSE values greater than 1 are adjusted to 1, leading to an adjusted feature weight of 0 (no impact on scoring).

Value

If scores_only = TRUE, a numeric vector of outlier scores is returned. If FALSE, return a list containing outlier scores, squared prediction errors, and adjusted feature weights (see details)

References

see "Outlier Analysis" (C.C Aggarwal. Springer, 2017) section 7.7

Examples

1
2
3
4
5
6
also <- ALSO_RF(data = iris, scores_only = FALSE)
also$scores
also$squared_prediction_errors
also$adjusted_feature_weights

ALSO_RF(data = iris, num.trees = 100) # pass arguments from ranger::ranger()

dannymorris/ALSO documentation built on May 4, 2019, 7:42 p.m.