CommencerCommencer gratuitement

Visualizing column importance

When the model is trained on different sets of columns it changes the performance, but does the importance for the same column change depending on which group it's in?

The data sets X2 and X3 have been created with the following code:

X2 = cr_loan_prep[['loan_int_rate','person_emp_length']]
X3 = cr_loan_prep[['person_income','loan_int_rate','loan_percent_income']]

Understanding how different columns are used to arrive at a loan_status prediction is very important for model interpretability.

The data sets cr_loan_prep, X2_train, X2_test, X3_train, X3_test, y_train, y_test are loaded in the workspace.

Cet exercice fait partie du cours

Credit Risk Modeling in Python

Afficher le cours

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Train a model on the X data with 2 columns
____ = xgb.____().____(____,np.ravel(____))

# Plot the column importance for this model
xgb.____(____, importance_type = 'weight')
plt.____()
Modifier et exécuter le code