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

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.

主站蜘蛛池模板: 汨罗市| 敦煌市| 瑞安市| 河源市| 上虞市| 东山县| 井冈山市| 丹阳市| 道真| 长寿区| 遂川县| 塘沽区| 仙游县| 和林格尔县| 余姚市| 陇川县| 黑河市| 南江县| 屯门区| 翁牛特旗| 同心县| 徐汇区| 田林县| 新竹县| 乌兰浩特市| 宁明县| 苗栗县| 彭州市| 门源| 孙吴县| 三门县| 定南县| 丰镇市| 沿河| 蓬安县| 南昌县| 临西县| 出国| 河北区| 曲水县| 吉水县|