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.
# Normalization
m <- 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 in the form of arriving at a strategy for handling missing values and inputting missing values wherever necessary.

In the next section, we will create a deep neural network architecture and then fit a model for the accurate prediction of the numeric target variable.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset