LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Credit Risk Modeling in Python

Kurs anzeigen

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# 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.____()
Code bearbeiten und ausführen