- 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.
推薦閱讀
- Splunk 7 Essentials(Third Edition)
- 輕輕松松自動化測試
- 影視后期制作(Avid Media Composer 5.0)
- Maya 2012從入門到精通
- Windows程序設計與架構
- 計算機系統結構
- 人工智能實踐錄
- Salesforce Advanced Administrator Certification Guide
- Mastering pfSense
- 手機游戲策劃設計
- 樂高創意機器人教程(中級 上冊 10~16歲) (青少年iCAN+創新創意實踐指導叢書)
- Microsoft Power BI Complete Reference
- Ubuntu 9 Linux應用基礎
- Kibana 7 Quick Start Guide
- 局域網應用一點通