我知道梯度下降和反向传播算法。我不明白的是:什么时候使用偏见是重要的,你如何使用它?

例如,在映射AND函数时,当我使用两个输入和一个输出时,它不会给出正确的权重。然而,当我使用三个输入(其中一个是偏差)时,它给出了正确的权重。


当前回答

如果您正在处理图像,实际上可能更喜欢完全不使用偏置。从理论上讲,这样你的网络将更独立于数据量,比如图片是暗的,还是亮的和生动的。网络将通过研究你的数据中的相对性来学习它的工作。很多现代神经网络都利用了这一点。

对于其他有偏差的数据可能是至关重要的。这取决于你要处理什么类型的数据。如果您的信息是大小不变的——如果输入[1,0,0.1]应该会导致与输入[100,0,10]相同的结果,那么没有偏差可能会更好。

其他回答

如果您正在处理图像,实际上可能更喜欢完全不使用偏置。从理论上讲,这样你的网络将更独立于数据量,比如图片是暗的,还是亮的和生动的。网络将通过研究你的数据中的相对性来学习它的工作。很多现代神经网络都利用了这一点。

对于其他有偏差的数据可能是至关重要的。这取决于你要处理什么类型的数据。如果您的信息是大小不变的——如果输入[1,0,0.1]应该会导致与输入[100,0,10]相同的结果,那么没有偏差可能会更好。

Two different kinds of parameters can be adjusted during the training of an ANN, the weights and the value in the activation functions. This is impractical and it would be easier if only one of the parameters should be adjusted. To cope with this problem a bias neuron is invented. The bias neuron lies in one layer, is connected to all the neurons in the next layer, but none in the previous layer and it always emits 1. Since the bias neuron emits 1 the weights, connected to the bias neuron, are added directly to the combined sum of the other weights (equation 2.1), just like the t value in the activation functions.1

它不实用的原因是,您同时调整权重和值,因此对权重的任何更改都会抵消对先前数据实例有用的值的更改……在不改变值的情况下添加偏置神经元可以让你控制层的行为。

此外,偏差允许您使用单个神经网络来表示类似的情况。考虑由以下神经网络表示的AND布尔函数:

(来源:aihorizon.com)

W0对应于b。 W1对应x1。 W2对应于x2。

A single perceptron can be used to represent many boolean functions. For example, if we assume boolean values of 1 (true) and -1 (false), then one way to use a two-input perceptron to implement the AND function is to set the weights w0 = -3, and w1 = w2 = .5. This perceptron can be made to represent the OR function instead by altering the threshold to w0 = -.3. In fact, AND and OR can be viewed as special cases of m-of-n functions: that is, functions where at least m of the n inputs to the perceptron must be true. The OR function corresponds to m = 1 and the AND function to m = n. Any m-of-n function is easily represented using a perceptron by setting all input weights to the same value (e.g., 0.5) and then setting the threshold w0 accordingly. Perceptrons can represent all of the primitive boolean functions AND, OR, NAND ( 1 AND), and NOR ( 1 OR). Machine Learning- Tom Mitchell)

阈值是偏置,w0是与偏置/阈值神经元相关的权重。

在神经网络中:

每个神经元都有一个偏向 您可以将偏差视为阈值(通常是阈值的相反值) 输入层的加权和+偏置决定神经元的激活 偏差增加了模型的灵活性。

在没有偏差的情况下,仅考虑来自输入层的加权和可能不会激活神经元。如果神经元没有被激活,来自该神经元的信息就不会通过神经网络的其余部分传递。

偏见的价值是可以学习的。

实际上,bias = - threshold。你可以把偏差想象成让神经元输出1有多容易,如果偏差很大,神经元输出1很容易,但如果偏差很大,就很难了。

总而言之:偏置有助于控制激活函数的触发值。

观看这段视频了解更多细节。

一些更有用的链接:

Geeksforgeeks

走向数据科学

单独修改神经元WEIGHTS只用于操纵传递函数的形状/曲率,而不是它的平衡/零交叉点。

引入偏置神经元允许您沿着输入轴水平(左/右)移动传递函数曲线,同时保持形状/曲率不变。 这将允许网络产生不同于默认值的任意输出,因此您可以自定义/移动输入到输出映射以满足您的特定需求。

请看这里的图表解释: http://www.heatonresearch.com/wiki/Bias

简单来说,如果你有y=w1*x,其中y是你的输出,w1是权重,想象一个条件,x=0,那么y=w1*x等于0。

如果你想要更新你的权重,你必须计算delw=target-y的变化量,其中target是你的目标输出。在这种情况下,'delw'将不会改变,因为y被计算为0。所以,假设你可以添加一些额外的值,这将有助于y = w1x + w01,其中偏差=1,权重可以调整以获得正确的偏差。考虑下面的例子。

就直线斜率而言,截距是线性方程的一种特殊形式。

Y = mx + b

检查图像

图像

这里b是(0,2)

如果你想把它增加到(0,3)你怎么通过改变b的值来实现呢?