What is the Sequential API?
A Sequential model is a simple stack of layers, one after the other, where each layer has exactly one input and one output. It is the easiest way to build a network in Keras and is perfect for most beginner projects.
Two Ways to Create a Sequential Model
keras.Input(shape=...). Then Keras knows the size of every layer immediately, and model.summary() works right away.
Reading model.summary()
A table listing each layer, its output shape and the number of parameters, followed by the total parameters.
For the model above, the first Dense layer has 20 x 64 weights plus 64 biases, which is 1,344 parameters.
Useful Dense Layer Options
| Option | Meaning |
|---|---|
units | Number of neurons |
activation | Activation function |
use_bias | Add the bias term (default True) |
kernel_initializer | How weights start, e.g. he_normal |
kernel_regularizer | L1 or L2 penalty |
name | A readable layer name |
Looking Inside the Weights
Freezing Layers
Plot the Model
This needs the pydot and graphviz tools to be installed. It is optional but nice for documentation.
Limitations of Sequential
- No multiple inputs or outputs
- No branches or skip connections
- No layer sharing
For these cases we use the Functional API, which is the next lesson.
Conclusion
Sequential is the fastest way to build a plain stack of layers. Use summary() often, and count parameters to understand the size of your model.

