Attribute-wise Learning for Scoring Outliers.

also(data, scale_numerics = TRUE, method, cross_validate = TRUE,
  n_folds = 5, scores_only = TRUE, ...)

Arguments

data

a matrix or data.frame.

scale_numerics

logical, if TRUE then center and scale numeric variables. If FALSE then ignore scaling

method

a function name in the form of a character string which is passed to formula (e.g. 'lm')

cross_validate

logical indicating the use of cross validation for scoring

n_folds

an integer specifying the number of folds if cross validating. Defaults to 5

scores_only

logical, if TRUE return outlier scores only. If FALSE return a list with outlier scores and the error matrix

...

additional arguments passed to method

Value

If scores_only = TRUE, only outlier scores are returned. If FALSE, the function returns a list containing outlier scores, feature RMSE, feature weights, raw prediction error matrix, squared prediction error matrix, and feature weighted squared prediction error matrix

References

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

Examples

# OLS with cross validation for out of sample scoring also(data = state.x77, scale_numerics = TRUE, method = 'lm', cross_validate = TRUE, n_folds = 10, scores_only = TRUE)
#> Error in make_tibble(data) %>% char_to_factor() %>% clear_colname_spaces() %>% mutate_if(is.numeric, funs(scale(., center = scale_numerics, scale = scale_numerics))): could not find function "%>%"
# random forest without cross validation#' rf_also <- also(data = scale(state.x77), scale_numerics = FALSE, method = 'randomForest', cross_validate = FALSE, scores_only = FALSE)
#> Error in make_tibble(data) %>% char_to_factor() %>% clear_colname_spaces() %>% mutate_if(is.numeric, funs(scale(., center = scale_numerics, scale = scale_numerics))): could not find function "%>%"
rf_also$scores; rf_also$feature_weights; rf_also$raw_error_matrix
#> Error in eval(expr, envir, enclos): object 'rf_also' not found
#> Error in eval(expr, envir, enclos): object 'rf_also' not found
#> Error in eval(expr, envir, enclos): object 'rf_also' not found