官术网_书友最值得收藏!

Sequential API

The model architecture in Keras can be built simply by stacking the layers one after the other. This is called the sequential approach in Keras and is the most common one:

from keras.models import Sequential. # importing the Sequential class
from keras.layers import Dense. #importing the Deep Learning layers

model = Sequential() #making an object of Sequential class

#adding the first Dense layer. You have to mention input dimensions to the first
#layer of model.
model.add(Dense(units=128, input_dims = 100, activation = 'relu))
model.add(Dense(units = 4, activation = 'softmax'))

When the model architecture is done, Keras uses a model.compile method to build the graph with the required loss function and optimizer and model.fit to train the model with inputs. If you're not getting what loss function is, don't worry! We will discuss all that in subsequent chapters.

主站蜘蛛池模板: 买车| 北流市| 陕西省| 昭觉县| 得荣县| 康马县| 芜湖市| 遂溪县| 特克斯县| 绩溪县| 峨眉山市| 梅河口市| 英山县| 绥棱县| 潮安县| 莱西市| 桃江县| 西丰县| 淮阳县| 万全县| 尚义县| 白朗县| 济源市| 阜新| 通榆县| 绥阳县| 绩溪县| 商河县| 辽宁省| 仁布县| 杭锦旗| 民勤县| 衡东县| 高平市| 清新县| 巢湖市| 双柏县| 沛县| 陵川县| 建瓯市| 岗巴县|