mlr (version 2.9)

capLargeValues: Convert large/infinite numeric values in a data.frame or task.

Description

Convert numeric entries which large/infinite (absolute) values in a data.frame or task. Only numeric/integer columns are affected.

Usage

capLargeValues(obj, target = character(0L), cols = NULL, threshold = Inf, impute = threshold, what = "abs")

Arguments

obj
[data.frame | Task] Input data.
target
[character] Name of the column(s) specifying the response. Target columns will not be capped. Default is character(0).
cols
[character] Which columns to convert. Default is all numeric columns.
threshold
[numeric(1)] Threshold for capping. Every entry whose absolute value is equal or larger is converted. Default is Inf.
impute
[numeric(1)] Replacement value for large entries. Large negative entries are converted to -impute. Default is threshold.
what
[character(1)] What kind of entries are affected? “abs” means abs(x) > threshold, “pos” means abs(x) > threshold && x > 0, “neg” means abs(x) > threshold && x < 0. Default is “abs”.

Value

[data.frame]

See Also

Other eda_and_preprocess: createDummyFeatures, dropFeatures, mergeSmallFactorLevels, normalizeFeatures, removeConstantFeatures, summarizeColumns

Examples

Run this code
capLargeValues(iris, threshold = 5, impute = 5)

Run the code above in your browser using DataCamp Workspace