【问题标题】:Understanding the role of layers and activation functions in Keras neural network理解层和激活函数在 Keras 神经网络中的作用
【发布时间】:2020-04-15 00:03:05
【问题描述】:

(28, activation="relu")函数的作用是什么,Dropoutsoftmax在mnist数据集的神经网络中需要对整个代码的每一层进行适当的指导

model = tf.keras.models.Sequential([
      tf.keras.layers.Flatten(input_shape=(28, 28)),
      tf.keras.layers.Dense(128, activation='relu'),
      tf.keras.layers.Dropout(0.2),
      tf.keras.layers.Dense(10, activation='softmax')
    ])

【问题讨论】:

  • 我建议阅读 Keras 的documentation。那里很好地解释了函数及其参数的作用。

标签: python tensorflow keras neural-network mnist


【解决方案1】:

数字 128,10 是网络中每一层的神经元数量。 tf.Dense() 用于创建图层。

relu、softmax 是激活函数,这些激活函数用于为神经元的输出提供非线性。

激活函数的目的在此处进行了很好的描述:

https://ai.stackexchange.com/questions/5493/what-is-the-purpose-of-an-activation-function-in-neural-networks.

Dropout 层用于为网络提供正则化,从而防止您的神经网络过度拟合。简单地说,通过 drop-out,一些神经元被停用,从而消除了特定特征之间的相互依赖关系。

看到这个:https://medium.com/@amarbudhiraja/https-medium-com-amarbudhiraja-learning-less-to-learn-better-dropout-in-deep-machine-learning-74334da4bfc5

【讨论】:

  • 我们如何知道,我们的神经网络需要多少神经元?
  • 这里有很好的解释:towardsdatascience.com/…查看这篇文章。
猜你喜欢
  • 2014-01-18
  • 2017-12-08
  • 2023-04-03
  • 2013-08-20
  • 2018-07-14
  • 2019-08-02
  • 2019-07-03
  • 1970-01-01
相关资源
最近更新 更多