Major Steps used in Deep Learning Model

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.

  1. Define the model. Sequential model or functional model –
  2. Compile the model and here you add loss function and optimizer before calling compile() function on the model
  3. Fit the model with the training dataset. And Test the model on test data by calling fit() function model
  4. Make a prediction — here you make a prediction by calling evaluate or predict() function

There are 8 steps in Deep Learning process:-

  1. Load the data
  1. Pre-process the data
  1. 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

  1. Compile the model

After defining the model in terms of layers, you need to declare the loss function, the optimizer and initial weights, BIAS

  1. 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.

  1. 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

  1. Make predictions

You can now make predictions on the unseen test data set

  1. 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