python-causality-handbook icon indicating copy to clipboard operation
python-causality-handbook copied to clipboard

Issue on page /15-Synthetic-Control.html

Open TXU0429 opened this issue 2 years ago • 1 comments

In the code from sklearn.linear_model import LinearRegression weights_lr = LinearRegression(fit_intercept=False).fit(X, y).coef_ weights_lr.round(3)

Isn't it fit(y, X) instead of fit(X, y)?

TXU0429 avatar Sep 08 '22 10:09 TXU0429

Hey, from looking at the API it seems like the order is correct. The predictor comes first: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html#sklearn.linear_model.LinearRegression.fit

TimoFlesch avatar Sep 08 '22 12:09 TimoFlesch