[英]Introduction part in Deep Learning with Keras using Python
Instruction of questions:问题指导:
Below is my code:下面是我的代码:
# Instantiate a Sequential model
model = Sequential()
# Add a Dense layer with 50 neurons and an input of 1 neuron
model.add(Dense(50, input_shape=(2,), activation='relu'))
# Add two Dense layers with 50 neurons and relu activation
model.add(Dense(____,____=____))
model.____
# End your model with a Dense layer and no activation
model.____
I am confused about the part我对这部分感到困惑
model.add(Dense(____,____=____))
In model.add(Dense(___,___=___))
, you have three blanks.在
model.add(Dense(___,___=___))
中,您有三个空白。 The first one is for mentioning number of neurons, the second one for saying that you want to set some value for activation
and the third one is for setting that value as relu
.第一个用于提及神经元的数量,第二个用于表示您想要设置一些
activation
值,第三个用于将该值设置为relu
。
So you will get model.add(Dense(50,activation='relu'))
所以你会得到
model.add(Dense(50,activation='relu'))
More information can be found in the Dense layer documentation .更多信息可以在密集层文档中找到。
In the documentation , the only required parameter for the Dense layer is units
, which is the number of neurons.在文档中,Dense 层唯一需要的参数是
units
,即神经元的数量。 The default activation function is None
, so if you want it to be "relu"
, do activation="relu"
.默认激活 function 是
None
,所以如果你希望它是"relu"
,请执行activation="relu"
。
In conclusion, this is that piece of code that creates a Dense layer with 50 neurons and activation as relu
:总之,这是一段代码,它创建了一个具有 50 个神经元并激活为
relu
的 Dense 层:
model.add(Dense(50, activation="relu"))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.