1. Learn
  2. /
  3. Courses
  4. /
  5. Explainable AI in Python

Connected

Exercise

Coefficients vs. permutation importance

Now, you will compare the patterns identified by permutation importance with the model coefficients from a logistic regression trained on the heart disease dataset. A helper function plot_importances() is called at the end of the script to plot importances on the same plot.

X containing the features and y containing the labels, and the logistic regression model have been pre-loaded for you. matplotlib.pyplot has been imported as plt.

Instructions

100 XP
  • Compute the coefficients of the logistic regression model.
  • Compute the permutation importance with 20 repeats using a random_state of 1.
  • Compute the average permutation importance across all repeats.