Description Usage Arguments Details Value Examples
Standardize training and test data by the information of training data. Test data is standardized using the information of training data.
1 | standardize(test, train, y_method = c("center", "scale"))
|
test |
Test data to standardize. |
train |
Training data that is standardized and used to standardize test data. |
y_method |
Decide how outcome will be standardized.
If |
Standardization will be done by following formula:
z = (x - mean(x)) / sd(x)
A list that has standardized training and test data, which includes standard deviation and mean of outcome, The outcome of test data is not changed.
train |
Standardized training data |
test |
Standardized test data |
y_mean |
A value used for centering (mean of outcome in training data) |
y_sd |
A value used for scaling (standard deviation of outcome in test data) |
1 2 3 4 5 6 | data_train <- data.frame(y = rnorm(10), x1 = rnorm(10), x2 = rnorm(10))
data_test <- data.frame(y = rnorm(10), x1 = rnorm(10), x2 = rnorm(10))
apply(data_train, 2, mean); apply(data_train, 2, sd)
data_scaled <- standardize(test = data_test,
train = data_train, y_method = "scale")
apply(data_scaled$train, 2, mean); apply(data_scaled$train, 2, sd)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.