shap 获得变量重要性

vals= np.abs(shap_values).mean(0)

feature_importance = pd.DataFrame(list(zip(X_train.columns,vals)),columns=['col_name','feature_importance_vals'])

feature_importance.sort_values(by=['feature_importance_vals'],ascending=False,inplace=True)

feature_importance.head() 

留言

熱門文章