I have recently started working Tensorflow for deep learning. I found this statement model = tf.keras.models.Sequential()
bit different. I couldn't understand what is actually meant and is there any other models as well for deep learning?
I worked a lot on MatconvNet (Matlab library for convolutional neural network). never saw any sequential definition in that.
There are two ways to build Keras models: sequential and functional.
The sequential API allows you to create models layer-by-layer for most problems. It is limited in that it does not allow you to create models that share layers or have multiple inputs or outputs.
Alternatively, the functional API allows you to create models that have a lot more flexibility as you can easily define models where layers connect to more than just the previous and next layers. In fact, you can connect layers to (literally) any other layer. As a result, creating complex networks such as siamese networks and residual networks become possible.
for more details visit : https://machinelearningmastery.com/keras-functional-api-deep-learning/
From the definition of Keras documentation the Sequential model is a linear stack of layers.You can create a Sequential model by passing a list of layer instances to the constructor:
from keras.models import Sequential
from keras.layers import Dense, Activation
model = Sequential([
Dense(32, input_shape=(784,)),
Activation('relu'),
Dense(10),
Activation('softmax'),
])
You can also simply add layers via the .add() method:
model = Sequential()
model.add(Dense(32, input_dim=784))
model.add(Activation('relu'))
For More details click here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With