The core data structure of Keras is a model, which is used organise layers.
General steps to training:
1. Create model (by adding layers)
2. Compile model to configure learning process .compile
3. Fit model by iterating on training data in batches, or manually train
4. Evaluate performance, or generate predictions .evaluate
, predict
Sequential Model Linear stack of layers.
Created by passing into constructor or by adding layers using the .add
method.
The model needs to know the input shape that it should expect.
Receives three arguments: an optimizer, a loss function, list of metrics
All Keras layers have a number of common methods
.get_weights
: return the weights of the layer as a list of Numpy arrays.set_weights
: sets the weights of the layer from a list of Numpy arrays.get_config
: returns a dictionary containing the configuration of the layerinput and output tensors can also be retrieved easily.
Batch normalization

Static == 0(test mode) Static == 1(train mode)