- 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/.
推薦閱讀
- 電腦常見問題與故障排除
- 基于Proteus和Keil的C51程序設(shè)計(jì)項(xiàng)目教程(第2版):理論、仿真、實(shí)踐相融合
- 電腦組裝、維護(hù)、維修全能一本通(全彩版)
- Apple Motion 5 Cookbook
- SiFive 經(jīng)典RISC-V FE310微控制器原理與實(shí)踐
- Source SDK Game Development Essentials
- 無蘋果不生活:OS X Mountain Lion 隨身寶典
- 基于PROTEUS的電路設(shè)計(jì)、仿真與制板
- FL Studio Cookbook
- 微服務(wù)實(shí)戰(zhàn)(Dubbox +Spring Boot+Docker)
- The Reinforcement Learning Workshop
- MicroPython Cookbook
- 現(xiàn)代多媒體技術(shù)及應(yīng)用
- 多媒體應(yīng)用技術(shù)(第2版)
- 計(jì)算機(jī)組裝與維護(hù)立體化教程(微課版)