We are now done with the data preprocessing that is necessary to prepare the data for machine learning. Now, it's time to start the fun part, where we actually get to build a neural network. We will train it using our training data, and then test it on our testing dataset:
- Let's go ahead and import the layers and models that we need to build the model. The following lines of code show all the imported layers:
from keras.models import Sequential
from keras.layers import Dense
from keras.optimizers import Adam
In the preceding code snippet, Adam is the standard optimizer that people use with deep neural networks and Keras.
- The next step is defining a function to build the Keras model, which can be done via the create_model() function. This function also gives us a way to replicate the model with slightly different parameters by defining inputs.
- Now...