- Deep Learning with Keras
- Antonio Gulli Sujit Pal
- 170字
- 2021-07-02 23:58:01
The first example of Keras code
The initial building block of Keras is a model, and the simplest model is called sequential. A sequential Keras model is a linear pipeline (a stack) of neural networks layers. This code fragment defines a single layer with 12 artificial neurons, and it expects 8 input variables (also known as features):
from keras.models import Sequential
model = Sequential()
model.add(Dense(12, input_dim=8, kernel_initializer='random_uniform'))
Each neuron can be initialized with specific weights. Keras provides a few choices, the most common of which are listed as follows:
- random_uniform: Weights are initialized to uniformly random small values in (-0.05, 0.05). In other words, any value within the given interval is equally likely to be drawn.
- random_normal: Weights are initialized according to a Gaussian, with a zero mean and small standard deviation of 0.05. For those of you who are not familiar with a Gaussian, think about a symmetric bell curve shape.
- zero: All weights are initialized to zero.
A full list is available at https://keras.io/initializations/.
推薦閱讀
- Raspberry Pi 3 Cookbook for Python Programmers
- 圖解西門子S7-200系列PLC入門
- Cortex-M3 + μC/OS-II嵌入式系統開發入門與應用
- 硬件產品經理成長手記(全彩)
- 精選單片機設計與制作30例(第2版)
- 基于ARM的嵌入式系統和物聯網開發
- AMD FPGA設計優化寶典:面向Vivado/SystemVerilog
- 深入理解序列化與反序列化
- 微型計算機系統原理及應用:國產龍芯處理器的軟件和硬件集成(基礎篇)
- 超大流量分布式系統架構解決方案:人人都是架構師2.0
- Istio服務網格技術解析與實踐
- 單片機原理及應用:基于C51+Proteus仿真
- 微服務實戰(Dubbox +Spring Boot+Docker)
- 基于S5PV210處理器的嵌入式開發完全攻略
- 分布式存儲系統:核心技術、系統實現與Go項目實戰