Weighted Non-negative Least Square Linear Regression in python [closed]

霸气de小男生 提交于 2019-12-06 05:53:36

You can simulate OLS weighting by modifying the X and y inputs. In OLS, you solve β for

XtX β = Xty.

In Weighted OLS, you solve

XtX W β = Xt W y.

where W is a diagonal matrix with nonnegative entries. It follows that W0.5 exists, and you can formulate this as

(X W0.5)t(XW0.5) β = (X W0.5)t(XW0.5) y,

which is an OLS problem with X W0.5 and W0.5 y.


Consequently, by modifying the inputs, you can use a non-negative constraint system which does not directly recognize weights.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!