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

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


当前回答

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

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

其他回答

偏差不是一个神经网络项。这是一个通用的代数术语。

Y = M*X + C(直线方程)

现在如果C(Bias) = 0,那么这条线将始终经过原点,即(0,0),并且只依赖于一个参数,即M,这是斜率,所以我们有更少的东西可以处理。

C,也就是偏置取任意数,都能移动图形,因此能够表示更复杂的情况。

在逻辑回归中,目标的期望值通过链接函数进行转换,以限制其值为单位区间。这样,模型预测可以被视为主要结果概率,如下所示:

Wikipedia上的Sigmoid函数

这是神经网络映射中打开和关闭神经元的最后一个激活层。在这里,偏差也发挥了作用,它灵活地平移曲线,帮助我们绘制模型。

在我研究的所有ML书籍中,W总是被定义为两个神经元之间的连通性指数,这意味着两个神经元之间的连通性更高。

放电神经元向目标神经元或Y = w * X传递的信号越强,为了保持神经元的生物学特性,我们需要保持1 >= w >= -1,但在实际回归中,w最终会变成| w | >=1,这与神经元的工作方式相矛盾。

因此,我提出W = cos(theta),而1 >= |cos(theta)|, Y= a * X = W * X + b而a = b + W = b + cos(theta), b是一个整数。

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是与偏置/阈值神经元相关的权重。

在我的硕士论文中的几个实验中(例如第59页),我发现偏差可能对第一层很重要,但特别是在最后的完全连接层,它似乎没有发挥很大的作用。

这可能高度依赖于网络架构/数据集。

下面是一些进一步的插图,展示了一个简单的2层前馈神经网络在一个双变量回归问题上的结果。权重被随机初始化,并使用标准的ReLU激活。正如我前面的答案所总结的那样,没有偏差,relu网络无法在(0,0)处偏离零。