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

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.

主站蜘蛛池模板: 咸宁市| 浦北县| 宁阳县| 丹寨县| 子洲县| 玉林市| 额尔古纳市| 兴隆县| 郴州市| 铜陵市| 方城县| 社会| 惠东县| 马龙县| 侯马市| 灵山县| 黔江区| 定襄县| 大渡口区| 凌源市| 互助| 诸城市| 岳池县| 安平县| 平阴县| 讷河市| 青冈县| 怀集县| 高密市| 鞍山市| 灵丘县| 汕尾市| 东源县| 马关县| 哈巴河县| 兰西县| 潍坊市| 济宁市| 南靖县| 杨浦区| 灵石县|