- Hands-On Deep Learning Architectures with Python
- Yuxi (Hayden) Liu Saransh Mehta
- 138字
- 2021-06-24 14:48:14
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.
推薦閱讀
- 大數(shù)據(jù)技術(shù)與應(yīng)用基礎(chǔ)
- 控制與決策系統(tǒng)仿真
- 輕松學(xué)PHP
- Visual C# 2008開發(fā)技術(shù)實(shí)例詳解
- Learning Apache Cassandra(Second Edition)
- 大數(shù)據(jù)技術(shù)入門(第2版)
- Embedded Programming with Modern C++ Cookbook
- DevOps:Continuous Delivery,Integration,and Deployment with DevOps
- Ceph:Designing and Implementing Scalable Storage Systems
- 計(jì)算機(jī)網(wǎng)絡(luò)原理與技術(shù)
- 信息物理系統(tǒng)(CPS)測試與評價技術(shù)
- 傳感器與新聞
- Microsoft System Center Confi guration Manager
- 統(tǒng)計(jì)挖掘與機(jī)器學(xué)習(xí):大數(shù)據(jù)預(yù)測建模和分析技術(shù)(原書第3版)
- Artificial Intelligence By Example