Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Credit Risk Modeling in Python

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# 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 bewerken en uitvoeren