0

How do I add a Regression table ( table that includes t-statistic, p-value, r^2 etc.). I've attached an image of some of my code.

Regression code

shiff desta
  • 31
  • 1
  • 4
  • Does this answer your question? [How to get a regression summary in Python scikit like R does?](https://stackoverflow.com/questions/26319259/how-to-get-a-regression-summary-in-python-scikit-like-r-does) – jkortner Jul 06 '20 at 18:49

2 Answers2

0

sklearn is aimed at predictive modeling, so you don’t get the regression table that you are used to. An alternative in Python to sklearn is statsmodels.

See also How to get a regression summary in Python scikit like R does?

jkortner
  • 549
  • 2
  • 8
  • 23
0

I have read about two ways statsmodel and classification_report

STATS MODEL

import statsmodels.api as sm

X = sm.add_constant(X.ravel())

results = sm.OLS(y,x).fit()

results.summary()

CLASSIFICATION REPORT

from sklearn.metrics import classifiation_report

y_preds = reg.predict(X_test)

print(classification_report(y_test,y_preds)

Raj Singh
  • 408
  • 1
  • 7
  • 17