Skip to content

Instantly share code, notes, and snippets.

@ImadDabbura
Created August 3, 2018 21:08
Show Gist options
  • Select an option

  • Save ImadDabbura/b22b0ead7befabdaaef89a35f51b5c41 to your computer and use it in GitHub Desktop.

Select an option

Save ImadDabbura/b22b0ead7befabdaaef89a35f51b5c41 to your computer and use it in GitHub Desktop.
# Plot partial dependence plots
gbrt = GradientBoostingClassifier(loss="deviance",
learning_rate=0.1,
n_estimators=100,
max_depth=3,
random_state=123)
gbrt.fit(X_res, y_res)
fig, axes = plot_partial_dependence(gbrt,
X_res,
np.argsort(gbrt.feature_importances_)[::-1][:8],
n_cols=4,
feature_names=df.columns[:-6],
figsize=(14, 8))
plt.subplots_adjust(top=0.9)
plt.suptitle("Partial dependence plots of borrower not fully paid\n" +
"the loan based on top most influential features")
for ax in axes:
ax.set_xticks(())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment