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

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.

主站蜘蛛池模板: 南康市| 屯留县| 东乡县| 宁明县| 称多县| 沐川县| 马公市| 卓尼县| 应城市| 青冈县| 东乡族自治县| 萨嘎县| 湖南省| 青浦区| 镇赉县| 南涧| 卓尼县| 高淳县| 自治县| 墨玉县| 民县| 改则县| 石泉县| 当涂县| 迁安市| 郁南县| 西藏| 固阳县| 新乡市| 札达县| 醴陵市| 龙南县| 连江县| 上蔡县| 内江市| 巫山县| 祥云县| 镇远县| 红原县| 仙游县| 黄大仙区|