In these series of blog posts we will look in detailed implementation of neural networks using Keras and also more deeply understand how neural networks work.
Basic Setup
You can setup Keras on your machine or as i prefer for these tutorial using Keras setup on “google colab”. If you are not aware what is google colab, its a cloud based system where you can get free Jupyter and you can easily start to work with ML. Read more here https://colab.research.google.com/notebooks/welcome.ipynb#scrollTo=5fCEDCU_qrC0 and setup new notebook to start with.
Keras?
To recap keras is a high level api for programming neural networks. My main reason for choosing this it make it quite easy to implement and understand NN’s
Models
The first thing we need to know about keras is Sequential Model.
Sequential model in a neural network is simply the NN we saw earlier, that is a sequence of layers.
To start with our first NN we need to do the following
import keras
from keras.models import Sequential
model = Sequential()
Quite simple!
Layers
Now since we have defined our NN, next we need to add layers to it.
model.add(Dense(8, input_shape=(1,)))
Ok, so here we have added a Dense layer. Lets pause at this step and understand it further.
Dense layer is the most basic layer in an NN in which all nodes are connected to next layer with weights.
The first argument to our Dense layer is the number of node’s we have specified it as 8.
The second argument is the shape of input layer. In our case its a 1D array hence 1,
We will discuss more about input data later on
At this stage you have a very basic NN setup with Kera’s.
You the function
model.summary()
to get a summary of your NN.
https://colab.research.google.com/drive/1IOjSB1PF85t9qEhCWgDbWxuCRSDz71H6
This is my notebook here which you can run to the see output.
Layers - More Detail
There are many more types of layers in NN, other than Dense layer like Convolution Layer, Pooling layer, and many more. Read more about them here https://deeplizard.com/learn/video/FK77zZxaBoI