To create and fit a deep neural network model for a regression problem, we will make use of Keras. The code used for the model architecture is as follows:
Note that the input layer having 13 units and the output layer having 1 unit is fixed based on the data; however, to arrive at a suitable number of hidden layers and the number of units in each layer, you need to experiment.
# Model architecture
model <- keras_model_sequential()
model %>%
layer_dense(units = 10, activation = 'relu', input_shape = c(13)) %>%
layer_dense(units = 5, activation = 'relu') %>%
layer_dense(units = 1)
summary(model)
OUTPUT
___________________________________________________________________________ Layer (type) Output Shape Param # =============================...