machine-learning - 为什么sigmoid会让梯度全部为正或负

标签 machine-learning

在cs231n类(class)中,当我浏览关于激活函数的注释时,我遇到了一个关于sigmoid函数的问题。这是屏幕截图:

cons and pros of sigmoid

在我看来,既然梯度dw = x.T dot doout,虽然现在x.T都是正数,但是矩阵相乘之后,为什么dw > 都是积极的还是消极的?唯一的可能性是 dout 都是正数或负数,但这是为什么呢?

有人可以帮助我吗?

最佳答案

如果您阅读了确切的句子,它的全文如下(略有转述):

If the data coming into a neuron is always positive then the gradient on the weights during backpropagation become either all positive or all negative (depending on the gradient of the whole expression f).

假设f = w^Tx + b 。那么相对于权重的梯度是 \nabla_w L = (dL/df)(df/dw) 。自 dL/df是一个标量,它要么是正数,要么是负数(或者为零,但这不太可能)。另一方面, df/dw = x 。很清楚如果 x全部为正或全部为负,则df/dw也都是全正或全负。但这意味着\nabla_w L也必须全部为正或全部为负,因为 dL/df无法更改 df/dw 的各个元素的符号不同。因此梯度的符号是齐次的。

关于machine-learning - 为什么sigmoid会让梯度全部为正或负,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51316611/

相关文章:

python - Tensorflow:二元分类的损失函数(没有一个热标签)

powershell - 从不同工作区复制后无法在 Azure ML Studio 上运行实验

python - 模型使用 SGD 进行学习,但不使用 Adam

python - 使用基于距离的方法对分类数据集进行聚类

python - 类型错误 : Cannot interpret feed_dict key as Tensor: Can not convert a int into a Tensor

python - Python 中用于预测的逻辑回归分类器

python - 使用多个输入提供 keras 模型

machine-learning - Vowpal Wabbit 多类分类预测概率

python - 值错误: Please initialize `TimeDistributed` layer with a `Layer` instance

machine-learning - 您会使用什么算法根据人员属性进行聚类?