问题描述
我知道有一个加权OLS求解器和受约束的OLS求解器.
是否有将两者结合起来的例程?
Is there a routine that combines the two?
推荐答案
您可以通过修改 X 和 y 输入来模拟OLS加权.在OLS中,您为
β 求解
You can simulate OLS weighting by modifying the X and y inputs. In OLS, you solve β for
X Xβ = X y .
XX β = Xy.
在加权OLS中,您可以解决
X X Wβ = X W y .
XX W β = X W y.
其中 W 是具有非负项的对角矩阵.因此,存在 W ,您可以将其表示为
where W is a diagonal matrix with nonnegative entries. It follows that W exists, and you can formulate this as
(X W )(XW )β =(X W )(XW )y ,
(X W)(XW) β = (X W)(XW) y,
这是具有 X W 和 W y 的OLS问题.
which is an OLS problem with X W and W y.
因此,通过修改输入,可以使用不直接识别权重的非负约束系统.
Consequently, by modifying the inputs, you can use a non-negative constraint system which does not directly recognize weights.
这篇关于Python中的加权非负最小二乘线性回归的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!