keras example sequential
Example 1: keras.sequential
from keras.models import Sequential
from keras.layers import Dense, Activation
model = Sequential([
Dense(32, input_shape=(784,)),
Activation('relu'),
Dense(10),
Activation('softmax'),
])
Example 2: 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))