Keras in Action
Build neural network model using Keras.
We'll cover the following...
Implementation of neural network using Keras
Let’s move on to the code as we have discussed each component in detail already. Here is the whole thing.
To save time, a decision boundary is created after 1000 epochs
. However to improve the decision boundary, epochs
must be increased as shown after the code widget for 30,000 epochs
.
Please wait for 1 minute after the training phase completes and then click the app link to preview the decision boundary:
<!DOCTYPE html> <html> <body> <center> <img src="graph.png" alt="output" width="600" height="400"> </center> </body> </html>
Here’s the output after training the network for 30,000 epochs
, stripped down to the essential information:
Using TensorFlow back-end.
Train on 285 samples, validate on 285 samples
Epoch 1 - loss: 0.7222 - acc: 0.5088 - val_loss: 0.6928 - val_acc: 0.4807
Epoch 2 - loss: 0.6966 - acc: 0.5018 - val_loss: 0.6904 - val_acc: 0.5193
…
Epoch 30000 - loss: 0.1623 - acc: 0.9193 - val_loss: 0.1975 - val_acc: 0.9018
The accuracy on the training set gets up to ...