列の重要度を可視化する
モデルを異なる列の組み合わせで学習させると性能は変わりますが、同じ列でも一緒に学習するグループによって重要度は変わるのでしょうか?
データセット X2 と X3 は次のコードで作成されています。
X2 = cr_loan_prep[['loan_int_rate','person_emp_length']]
X3 = cr_loan_prep[['person_income','loan_int_rate','loan_percent_income']]
loan_status を予測する際に、各列がどのように使われているかを理解することは、モデルの解釈可能性にとって非常に重要です。
ワークスペースには cr_loan_prep, X2_train, X2_test, X3_train, X3_test, y_train, y_test が読み込まれています。
この演習はコースの一部です
Pythonで学ぶクレジットリスクモデリング
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# 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.____()