machine-learning - 什么是体重衰减?

标签 machine-learning tensorflow deep-learning linear-algebra

我最近开始使用 ML 和 TensorFlow。在经历CIFAR10-tutorial时在网站上我看到一段让我有点困惑的段落:

The usual method for training a network to perform N-way classification is multinomial logistic regression, aka. softmax regression. Softmax regression applies a softmax nonlinearity to the output of the network and calculates the cross-entropy between the normalized predictions and a 1-hot encoding of the label. For regularization, we also apply the usual weight decay losses to all learned variables. The objective function for the model is the sum of the cross entropy loss and all these weight decay terms, as returned by the loss() function.

我在论坛上读过一些关于什么是权重衰减的答案,我可以说它是用于正则化的目的,以便可以计算权重值以获得最小的损失和更高的准确性。

现在,在上面的文本中,我了解到 loss() 由交叉熵损失(即预测和正确标签值的差异)和权重衰减损失组成。

我很清楚交叉熵损失,但是这个权重衰减损失是什么,为什么不只是权重衰减呢?这个损失是如何计算的?

最佳答案

权重衰减只不过是权重的L2正则化,可以使用tf.nn.l2_loss来实现。

正则化的损失函数由下式给出:

enter image description here

上式的第二项定义了权重 (theta) 的 L2 正则化。一般是为了避免过拟合而添加的。这会惩罚峰值权重并确保考虑所有输入。 (很少的峰值权重意味着只有那些与之相关的输入才会被考虑用于决策。)

在梯度下降参数更新过程中,上述L2正则化最终意味着每个权重都线性衰减:W_new = (1 - lambda)* W_old + alpha*delta_J/delta_w。这就是为什么它通常被称为权重衰减

关于machine-learning - 什么是体重衰减?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45540908/

相关文章:

java - 为什么 MALLET LDA 需要保持序列?

python - 如何在 Tensorflow 中使用 tf.layers.dense 和 tf.data.Dataset 开发神经网络?

python - tf.unique 不重复索引

tensorflow - 使密集层的一些内核参数不可训练

machine-learning - 将 TensorFlow LSTM 转换为 synapticjs

python - SciKit-Learn GradientBoostingClassifier 中的零重要性特征删除无需重新调整

python - 编码器一热混淆

python - 不能获取等级未知的 Shape 的长度

deep-learning - Keras 中的 Convolutional2D Siamese 网络

python - 如何在colab中解压图片文件夹