Sequential Model is a linear stack of layers.
Creating Sequential Model:
We can also add layers via the .add() method
If you ever need to specify a fixed batch size for your inputs(this is useful for stateful recurrent networks),you can pass a batch_size argument to a layer.If you pass both batch_size=32 and input_shape=(6,8) to a layer, it will then expect every batch of inputs to have a batch shape (32,6,8).
Some 2D layers, such as Dense supports the specification of their input shape via the argument input_dim and some 3D layers supports the arguments input_dim and input_length.
Learning process is configured via the compile method.It recieves three arguments:
An Optimizer :- These is an instance of optimizer class.
Every time a neural network finishes passing a batch through the network and generating prediction result,it must decide how to use the difference b/w the results it got and values to be true to adjust the weights on the nodes so that the network step towards the solution.The algorithm that determines that step is known as optimization algorithm.
A Loss Function :-
This is the objective that the model will try to minimize.The loss function is used to optimize your model.This is the function that will get minimized by the optimizer.Loss function is used to estimate the loss of the model so that the weights can be updated to reduce the loss on the next evaluation.
A List of Metrics :-
For any classification problem you will set these to metrics = ['accuracy'].A metrics is used to judge the performance of your model.This is only for you to look at and has nothing to do with the optimization process.
For Multi-Class Classification Problem
For Binary-Class Classification Problem
For Custom metrics
Keras models are trained on numpy array of input data and labels.For training a model we make use of fit function.
For single-input model with 2 classes (Binary Classification)