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

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

主站蜘蛛池模板: 同德县| 永新县| 蚌埠市| 武强县| 常山县| 视频| 五大连池市| 新安县| 衡阳县| 宝丰县| 广河县| 阳西县| 蚌埠市| 沐川县| 磐安县| 台安县| 墨竹工卡县| 梧州市| 大厂| 通城县| 都兰县| 杨浦区| 西林县| 沁源县| 揭阳市| 营山县| 乡城县| 宜兴市| 夏津县| 广安市| 镇原县| 旬邑县| 咸阳市| 和田市| 邯郸市| 泰兴市| 专栏| 林周县| 施秉县| 壤塘县| 南江县|