Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I know there is an weighted OLS solver, and a constrained OLS solver.

Is there a routine that combines the two?

like image 459
RAY Avatar asked Jan 23 '26 04:01

RAY


1 Answers

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.

like image 138
Ami Tavory Avatar answered Jan 24 '26 18:01

Ami Tavory