Designing a deep neural network with five hidden layers using Keras

Keras uses the concept of layers when working with models. There are two ways to do so. The simplest way is by using a sequential model for a linear stack of layers. The other is the functional API for building complex models such as multi-output models, directed acyclic graphs, or models with shared layers. This means that the tensor output from a layer can be used to define a model, or a model itself can become a layer:

  1. Let's use the Keras library and create a Sequential model:
In [ ]:    from keras.models import Sequential    from keras.layers import Dense    from keras.layers import Dropout    from keras.layers.normalization import BatchNormalization  num_features = train_scaled_x.shape[1] ...

Get Mastering Python for Finance - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.