Search code examples
pythonnon-linear-regressionlasso-regression

Using Lasso for non-linear regression (Python)


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?


Solution

  • 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