Developing the model architecture

When developing the model architecture, we start by creating a sequential model and then add various layers. The following is the code:

# Model architecture
model <- keras_model_sequential()
model %>%
layer_dense(units = 256, activation = 'relu', input_shape = c(2352)) %>%
layer_dense(units = 128, activation = 'relu') %>%
layer_dense(units = 3, activation = 'softmax')
summary(model)

OUTPUT
______________________________________________________________________
Layer (type) Output Shape Param #
======================================================================
dense_1 (Dense) (None, 256) 602368
______________________________________________________________________
dense_2 (Dense) (None, 128) 32896
_____________________________________________________________________
dense_3 (Dense) (None, 3) 387
======================================================================
Total params: 635,651
Trainable params: 635,651
Non-trainable params: 0
_______________________________________________________________________

As can be seen from the preceding code, the input layer has  2352 units (28 x 28 x 3). For the initial model, we use two hidden layers with 256 and 128 units respectively. For both hidden layers, we will use the relu activation function. For the output layer, we will use 3 units since the target variable has 3 classes, representing a bicycle, car, and airplane. The total number of parameters for this model is 635,651.

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

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