Normalization

To normalize the data, the mean and standard deviations are obtained for all independent variables in the training data. Normalization is then carried out using the scale function:

For both the train and test data, the mean and standard deviations are based on the training data used.
# Normalizationm <- colMeans(training)sd <- apply(training, 2, sd)training <- scale(training, center = m, scale = sd)test <- scale(test, center = m, scale = sd)

This concludes the data preparation step for this data. It should be noted that different datasets may need extra steps that are unique to that dataset—for example, many large datasets may have very high amounts of missing data values, and they may require additional data preparation steps ...

Get Advanced Deep Learning with R now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.