View source: R/data_preprocessing.R
scale_data | R Documentation |
This function standardizes numeric columns of the train_data
and applies
the same scaling (mean and standard deviation) to the corresponding columns
in apply_data
. It returns the standardized data along with the scaling
parameters (means and standard deviations). This is particularly important
for neural network approaches as they tend to be numerically unstable and
deteriorate otherwise.
scale_data(train_data, apply_data)
train_data |
A data frame containing the training dataset to be standardized. It must contain numeric columns. |
apply_data |
A data frame containing the dataset to which the scaling
from |
A list containing the following elements:
train |
The standardized training data. |
apply |
The |
means |
The means of the numeric columns in |
sds |
The standard deviations of the numeric columns in |
data(mock_env_data)
detrended_list <- list(
train = mock_env_data[1:80, ],
apply = mock_env_data[81:100, ]
)
scale_result <- scale_data(
train_data = detrended_list$train,
apply_data = detrended_list$apply
)
scaled_train <- scale_result$train
scaled_apply <- scale_result$apply
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.