February 2020
Intermediate to advanced
328 pages
8h 19m
English
The Boston Housing Prices dataset can be accessed directly from the keras library. It has 404 training examples and 102 test examples.
Let's load the required libraries:
library(mxnet)library(keras)
We load the dataset and split it into training and testing sets:
boston = dataset_boston_housing()train_x = boston$train$xtrain_y = boston$train$ytest_x = boston$test$xtest_y = boston$test$y
Let's now scale the dataset:
# normalize train settrain_x <- scale(train_x)# normalize test settrain_means <- attr(train_x, "scaled:center") train_stddevs <- attr(train_x, "scaled:scale")test_x <- scale(test_x, center = train_means, scale = train_stddevs)
This completes the data preprocessing part.
Read now
Unlock full access