Constrained Least-squares Estimation In Python
I'm trying to perform a constrained least-squares estimation using Scipy such that all of the coefficients are in the range (0,1) and sum to 1 (this functionality is implemented in
Solution 1:
scipy-optimize-leastsq-with-bound-constraints on SO givesleastsq_bounds
, which is
leastsq
with bound constraints such as 0 <= x_i <= 1.
The constraint that they sum to 1 can be added in the same way.
(I've found leastsq_bounds
/ MINPACK to be good on synthetic test functions in 5d, 10d, 20d;
how many variables do you have ?)
Solution 2:
Have a look at this tutorial, it seems pretty clear.
Solution 3:
Since MATLAB's lsqlin
is a bounded linear least squares solver, you would want to check out scipy.optimize.lsq_linear.
Post a Comment for "Constrained Least-squares Estimation In Python"