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

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/.

主站蜘蛛池模板: 惠水县| 舞钢市| 富宁县| 沐川县| 长兴县| 苗栗县| 长寿区| 高台县| 牙克石市| 板桥市| 南投市| 体育| 兴安盟| 威海市| 桂平市| 吉首市| 青神县| 恭城| 西乌| 新竹县| 雅江县| 南乐县| 界首市| 乐平市| 海盐县| 尤溪县| 南通市| 崇信县| 雅江县| 宿州市| 花莲市| 莱州市| 乌兰察布市| 上饶县| 新竹县| 广昌县| 红河县| 宁城县| 丹巴县| 阿尔山市| 额济纳旗|