keras如何定义输入层(基本理解)层数
我尝试遵循教程。
模型的构建以
netw <- keras_model_sequential()
### one input layer, one output layer and one hidden layer
netw %>% layer_dense(units = 500, activation = "relu", input_shape = c(6)) %>%
layer_dense(units=300, activation="relu") %>%
layer_dense(units=2, activation="softmax")
单元的形式开始定义节点的数量。我对层数感到困惑。由于有6个功能,因此输入层应具有6个节点。为什么它的单位= 500?这是否真的指定了一个带有6个节点的输入层和一个带有500个节点的第二层?因此,评论中会有4层而不是三层?
I try to follow a tutorial.
The building of the model starts with
netw <- keras_model_sequential()
### one input layer, one output layer and one hidden layer
netw %>% layer_dense(units = 500, activation = "relu", input_shape = c(6)) %>%
layer_dense(units=300, activation="relu") %>%
layer_dense(units=2, activation="softmax")
units define the number of nodes. I am confused about the number of layers. The input layer should have 6 nodes, since there are 6 features. Why does it have units=500? Does this really specify an input layer with 6 nodes and a second layer with 500 nodes? So there would be 4 layers instead of the three stated in the comment?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
输入形状确实是指输入层的大小。这是被馈入网络的数据点的数量,而
单位= 500
是传递数据的网络节点数量。这是您模型的可视化:
如您所见,模型中确实有四层。通常不计算输入层,因为每个网络通常都包含一个输入层。更具体地说,输入层不是计算层,因此只进行了三个级别的计算层。
The input shape does refer to the size of the input layer. This is the number of data point being fed into the network while
units = 500
is the number of network nodes the data is being passed to.Here is a visualization of your model:
As you can see, there are indeed four layers in the model. The input layer is not generally counted because every network will generally contain an input layer. More specifically, the input layer is not a computation layer, so there are only three levels of computation being carried out.