what is sequential model in keras code example

Example: keras declare sequential model

from keras.models import Sequential
from keras.layers import Dense
# NOTE: this is only how you declare a sequential model
# Declare a sequential model by adding layers to it
model = Sequential()
# Adding layer with size 2 and input dimensions 1
model.add(Dense(2, input_dim=1))
# Output size of the model will be the size of the last layer
model.add(Dense(1))
# This can also be done by passing the layers as an array
model2 = Sequential([Dense(2, input_dim=1), Dense(1)])
# or even a mixture of both
model2.add(Dense(1))

Tags:

Misc Example