Reputation: 10332
If I perform a linear regression in R, I get a nice summary of the resulting model, $R^2$, p-values for different features, etc.
If I do the same in scikit_learn, I get nothing of this. Are there any ways to print summary of the model there?
Upvotes: 2
Views: 6692
Reputation: 1609
Scikit-learn does not, to my knowledge, have a summary function like R. However, statmodels, another Python package, does. Plus, it's implementation is much more similar to R.
from statsmodels.formula.api import ols
#you need a Pandas dataframe df with columns labeled Y, X, & X2
est = ols(formula = 'Y ~ X + X2', data = df).fit()
est.summary()
Upvotes: 6