If I have independent variables [x1, x2, x3] If I fit linear regression in sklearn it will give me something like this:
y = a*x1 + b*x2 + c*x3 + intercept
Use patsy to construct a design matrix as follows:
y, X = dmatrices('y ~ x1 + x2 + x3 + x1:x2', your_data)
Where your_data is e.g. a DataFrame with response column y and input columns x1, x2 and x3.
your_data
y
x1
x2
x3
Then just call the fit method of your estimator, e.g. LinearRegression().fit(X,y).
fit
LinearRegression().fit(X,y)