Reputation: 1646
I have a set of independent data points X, and a set of dependent points Y, and I would like to find a model of the form:
(a0+a1*x1+a2*x2+...+amxm)(am+1*xm+1+am+2*xm+2)
I know I can use scipy's curve_fit, but to avoid overfitting, I want to use Lasso for the linear part (i.e. the part in the first set of parenthesis).
Is there a simple way of doing that in Python?
Upvotes: 1
Views: 3605
Reputation: 195
You can fit a lasso regressor to the whole lot, multiplying out your brackets giving you 2m+2 coefficients. Then by performing a change of variables you can make this a linear regression problem again.
See this link for more details: http://scikit-learn.org/stable/modules/linear_model.html#polynomial-regression
Upvotes: 1