step_outliers_outForest | R Documentation |
step_outliers_outForest
creates a specification of a recipe
step that will calculate the outlier score using outForest from outForest
, it internally handles missing data.
step_outliers_outForest( recipe, ..., role = NA, trained = FALSE, outlier_score = NULL, columns = NULL, name_mutate = ".outliers_outForest", options = list(formula = . ~ ., replace = c("pmm", "predictions", "NA", "no"), pmm.k = 3, threshold = 3, max_n_outliers = Inf, max_prop_outliers = 1, min.node.size = 40, allow_predictions = FALSE, impute_multivariate = TRUE, impute_multivariate_control = list(pmm.k = 3, num.trees = 50, maxiter = 3L), seed = NULL, verbose = 0), outlier_score_function = mean, original_result = FALSE, skip = TRUE, id = rand_id("outliers_outForest") ) ## S3 method for class 'step_outliers_outForest' tidy(x, ...)
recipe |
A recipe object. The step will be added to the sequence of operations for this recipe. |
... |
One or more selector functions to choose variables
for this step. See |
role |
not defined for this function |
trained |
A logical to indicate if the quantities for preprocessing have been estimated. |
outlier_score |
a placeholder for the exit of this function don't change |
columns |
A character string of variable names that will be populated (eventually) by the terms argument. |
name_mutate |
the name of the generated column with outForest results |
options |
a list with arguments to outForest function. |
outlier_score_function |
a function to decide when there are multivariate outlier scores how to combine them, some examples would be sum or median |
original_result |
an argument to return a tibble row with the original results of the function instead of an computed score |
skip |
A logical. Should the step be skipped when the
recipe is baked by |
id |
A character string that is unique to this step to identify it. |
x |
A |
All columns in the data are sampled and returned by juice()
and bake()
.
All columns used in this step must be numeric with no missing data.
When used in modeling, users should strongly consider using the
option skip = TRUE
so that this operation is not
conducted outside of the training set.
An updated version of recipe
with the new step
added to the sequence of existing steps (if any), with the name on name_mutate
and the probabilities calculated. For the
tidy
method, a tibble with columns index
(the row indexes of the tibble) and outlier_score
(the scores).
library(recipes) library(tidy.outliers) rec <- recipe(mpg ~ ., data = mtcars) %>% step_outliers_outForest(all_numeric_predictors()) %>% prep(mtcars) bake(rec, new_data = NULL) tidy(rec, number = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.