【问题标题】:Is there any documentation about the default weight initializer in Keras? [duplicate]Keras 中默认的权重初始化器是什么? [复制]
【发布时间】:2019-05-29 09:16:30
【问题描述】:

我刚刚在here 中阅读了有关 Keras 权重初始化器的信息。在文档中,只介绍了不同的初始化程序。如:

model.add(Dense(64, kernel_initializer='random_normal'))

当我没有指定kernel_initializer 参数时,我想知道默认权重 是什么。 有没有办法访问它?

【问题讨论】:

  • 默认是 glorot 初始化器。它从 [-limit, limit] 内的均匀分布中抽取样本,其中 limit 是 sqrt(6 / (fan_in + fan_out)) 其中 fan_in 是权重张量中的输入单元数,而 fan_out 是权重中的输出单元数张量。

标签: python machine-learning keras neural-network


【解决方案1】:

每一层都有自己的初始化权重的默认值。对于大多数层,例如Dense、卷积和 RNN 层,默认的内核初始化器是 'glorot_uniform',默认的偏置初始化器是 'zeros'(您可以在文档;例如here 是密集层文档)。您可以在 Keras 文档中找到 glorot_uniform 初始化程序 here 的定义。

关于获取每一层的权重,已经回答here了。

【讨论】:

  • 我认为这篇文章很有趣,它大致表明对于"tanh" 激活您应该使用'glorot_uniform',对于"relu" 层您应该使用"he_uniform"towardsdatascience.com/…
猜你喜欢
  • 2018-09-23
  • 1970-01-01
  • 1970-01-01
  • 2016-09-17
  • 2016-04-26
  • 2011-03-26
  • 2022-11-17
  • 1970-01-01
相关资源
最近更新 更多