1import matplotlib.pyplot as plt
2from xgboost import plot_importance, XGBClassifier # or XGBRegressor
3
4model = XGBClassifier() # or XGBRegressor
5
6# X and y are input and target arrays of numeric variables
7model.fit(X,y)
8plot_importance(model, importance_type = 'gain') # other options available
9plt.show()
10# if you need a dictionary
11model.get_booster().get_score(importance_type = 'gain')