I have the following linear model
regressor = LinearRegression()
regressor.fit(X_train, y_train)
y_pred = regressor.predict(X_test)
Then, I create a coefficient-feature table by doing:
# List of features
features = list(dataset2.iloc[:, 0:-1].columns)
# List of coefficients
coefficients = regressor.coef_
coefficients = list(coefficients)
data = {"Features": features,
"Coefficients": coefficients}
coeff_table = pd.DataFrame(data)
coeff_table
>>
Features Coefficients
0 x1 -6.355051e-07
1 x1 2.155908e-06
2 x3 3.747445e-04
3 x4 -2.002543e-05
4 x5 7.554939e-06
5 x6 7.073696e-06
6 x7 3.017401e-04
7 x8 3.173331e-03
8 x9 3.513537e-04
9 x10 3.232741e-05
I would like to also compute the standard error and add it to my table. I am wondering what the best approach to do it is. I keep either finding answers too long or not suitable for my model (they use OLS()).