fast_scale {dataPreparation} R Documentation

## scale

### Description

Perform efficient scaling on a data set.

### Usage

fast_scale(data_set, scales = NULL, way = "scale", verbose = TRUE)


### Arguments

 data_set Matrix, data.frame or data.table scales Result of funcion build_scales, (list, default to NULL). To perform the same scaling on train and test, it is recommended to compute build_scales before. If it is kept to NULL, build_scales will be called. way should scaling or unscaling be performed? (character either "scale" or "unscale", default to "scale") verbose Should the algorithm talk? (Logical, default to TRUE)

### Details

Scaling numeric values is usefull for some machine learning algorithm such as logistic regression or neural networks.
Unscaling numeric values can be very usefull for most post-model analysis to do so set way to "unscale".
This implementation of scale will be faster that scale for large data sets.

### Value

data_set with columns scaled (or unscaled) by reference. Scaled means that each column mean will be 0 and each column standard deviation will be 1.

### Examples

# Load data

# compute scales
scales <- build_scales(adult, cols = "auto", verbose = TRUE)

# Scale data set
print(mean(adult$age)) # Almost 0 print(sd(adult$age)) # 1
print(mean(adult$age)) # About 38.6 print(sd(adult$age)) # About 13.6