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

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

主站蜘蛛池模板: 威宁| 卫辉市| 蓝田县| 平湖市| 清新县| 岳阳市| 南靖县| 石楼县| 华蓥市| 漳浦县| 高州市| 怀来县| 定南县| 左权县| 绵竹市| 大城县| 金秀| 顺平县| 临猗县| 济源市| 麟游县| 昌图县| 和林格尔县| 彭州市| 华蓥市| 屯昌县| 扎囊县| 垦利县| 安吉县| 乌鲁木齐市| 秭归县| 贺州市| 伊宁市| 古丈县| 抚州市| 巴中市| 太保市| 五华县| 信阳市| 黄龙县| 皮山县|