Original article can be found here (source): Deep Learning on Medium
Major Steps used in Deep Learning Model
What is the Sequential model and Functional API in Keras? What is the loss function, types of it? what are the optimizer and its type?
If you’ve not gone through, Understand the concepts of Deep learning before this.
- Define the model. Sequential model or functional model –
- Compile the model and here you add loss function and optimizer before calling compile() function on the model
- Fit the model with the training dataset. And Test the model on test data by calling fit() function model
- Make a prediction — here you make a prediction by calling evaluate or predict() function
There are 8 steps in Deep Learning process:-
- Load the data
- Pre-process the data
- Define the model
At this step, You can define the model either sequential or Functional model you can use. Here I defined the sequential model
Difference between Sequential model and Functional Model is
The sequential API allows you to create models layer-by-layer for most problems. It is limited in that it does not allow you to create models that share layers or have multiple inputs or outputs.
Alternatively, the functional API allows you to create models that have a lot more flexibility as you can easily define models where layers connect to more than just the previous and next layers. In fact, you can connect layers to (literally) any other layer. As a result, creating complex networks such as siamese networks and residual networks become possible. | Source- Jovianil |
Number of layers to be used, Number of nodes to be used in the model, Evaluation metrics
This Question may hit your brain- How many layers to be used and Neurons?
Well! There is no method for finding the right number of layers for your architecture. But You can understand this in this way. Look at your dataset if you find it very complex, Increase the number of layers, Do not increase the number of neurons because it makes the architecture more complex
- Compile the model
After defining the model in terms of layers, you need to declare the loss function, the optimizer and initial weights, BIAS
- Fit the model
Having defining the model and compiling the model, You need to make predictions by executing the model on the same data. Here you will specify the epochs (Epochs are number of iterations for the training process to run through the dataset and Batch size is a number of instances that are evaluated before the weight update
Question:- How will you select the best epochs and batch size?, Remember batch size should be less than the size of the training dataset to consume less memory, Will answer to this questions + Parameters in Deep Learning in future blogs.
- Evaluate the model
Remember this step will only give you How well have you modeled the dataset (Training dataset accuracy), But you won’t be able to know how well your algorithms will perform on new unseen data
- Make predictions
You can now make predictions on the unseen test data set
- Save the model
When you are building a model(For image dataset), It is very important to understand that
Every input layer has the right number of inputs