Created
May 9, 2020 12:50
-
-
Save VincentTatan/2b1ea04a1e23e2500da5cd19803cb1ec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_logistic_regressions(X_train,y_train,figsize=(10,10)): | |
logreg = LogisticRegression(solver='lbfgs') | |
logreg.fit(X_train, y_train) | |
coefficients = logreg.coef_ | |
intercept = logreg.intercept_ | |
df_logreg = pd.DataFrame({'Feature':X_train.columns,'Coef':logreg.coef_[0]}) | |
fig, ax = plt.subplots(figsize=figsize) | |
sns.barplot(x="Coef", y="Feature", data=df_logreg, ax=ax) | |
return logreg, df_logreg.set_index('Feature') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment