I am wondering if you we can get the feature importance as a list of columns instead of a plot. This is what I have

xg_reg = xgb.train(params=params, dtrain=data_dmatrix, num_boost_round=10)
import matplotlib.pyplot as plt

plt.rcParams['figure.figsize'] = [5,5]

Which gives me this plot

enter image description here

I would like to instead just get a list of the top features since I have over 800 different features.

Snorrlaxxx 23 Juli 2020, 20:57

1 menjawab

Jawaban Terbaik

You can use xgb.get_score(). Here are a number of examples: How to get feature importance in xgboost?

jared_mamrot 24 Juli 2020, 10:55