In the following example, we will use the Keras API. Keras is an open source high-level framework for building deep neural networks. It's written on top of TensorFlow or Theano and uses them for its calculations behind the scenes. Keras can run on both CPU and GPU. The default settings of Keras are designed to deliver good results in most cases.
The focus of Keras is the idea of a model. Keras supports two types of models. The main type of model is a sequence of layers, called sequential. The other type of model in Keras is the non-sequential model, called model.
To build a sequential model, carry out the following steps:
- Instantiate a sequential model using Sequential()
- Add layers to it one by one using the Dense class
- Compile the model with the following:
- A mandatory loss function
- A mandatory optimizer
- Optional...