I am trying to fit a regression equation of the following type in sklearn
y=ax+bx^2+cx^3+dx^5.......
I have a condition on the range of a i.e a should be between amin and amax. Is there a way to do it?
I am trying to fit a regression equation of the following type in sklearn
y=ax+bx^2+cx^3+dx^5.......
I have a condition on the range of a i.e a should be between amin and amax. Is there a way to do it?
Copyright © 2021 Jogjafile Inc.
There is no way to do this using sklearn (that I am aware of).
sklearn.linear_model.LinearRegression only allows non-negative least squares by specifying
positive=Truein theLinearModelconstructor. Under the hood scipy.optimize.nnls is used for this.However, the constraint linear regression model you want can be estimated using scipy.optimize.lsq_linear.