Python中的加权非负最小二乘线性回归 [英] Weighted Non-negative Least Square Linear Regression in python

查看:524
本文介绍了Python中的加权非负最小二乘线性回归的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道有一个加权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 t Xβ = X t y .

XtX β = Xty.

在加权OLS中,您可以解决

X t X Wβ = X t W y .

XtX W β = Xt W y.

其中 W 是具有非负项的对角矩阵.因此,存在 W 0.5 ,您可以将其表示为

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

(X W 0.5 ) t (XW 0.5 )β =(X W 0.5 ) t (XW 0.5 )y

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

这是具有 X W 0.5 W 0.5 y 的OLS问题.

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.

这篇关于Python中的加权非负最小二乘线性回归的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆