我正在使用多个特征进行线性回归。我决定使用正规方程方法来查找线性模型的系数。如果我们使用梯度下降进行多变量线性回归,我们通常会进行特征缩放以加快梯度下降收敛。现在,我将使用正规方程公式:
我有两个相互矛盾的信息来源。在第 1 部分中,指出正规方程不需要特征缩放。在另一个例子中,我可以看到必须完成特征标准化。 来源:
http://puriney.github.io/numb/2013/07/06/normal-equations-gradient-descent-and-linear-regression/
在这两篇文章的末尾提供了有关正规方程中特征缩放的信息。
问题是在正态方程分析之前我们需要进行特征缩放吗?
最佳答案
您可能确实不需要扩展您的功能,并且从理论角度来看,您只需“一步”即可获得解决方案。然而,在实践中,情况可能会有所不同。
注意公式中的矩阵求逆。矩阵求逆并不是一个简单的计算操作。事实上,有一个衡量矩阵求逆(并执行一些其他计算)的难度的方法,称为 condition number :
If the condition number is not too much larger than one (but it can still be a multiple of one), the matrix is well conditioned which means its inverse can be computed with good accuracy. If the condition number is very large, then the matrix is said to be ill-conditioned. Practically, such a matrix is almost singular, and the computation of its inverse, or solution of a linear system of equations is prone to large numerical errors. A matrix that is not invertible has condition number equal to infinity.
附注大条件数实际上是减慢梯度下降收敛速度的同一个问题。
关于machine-learning - 使用正态方程方法进行多元回归分析中的特征缩放(归一化)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34148912/