📅  最后修改于: 2022-03-11 14:45:56.651000             🧑  作者: Mango
import matplotlib.pyplot as plt
from xgboost import plot_importance, XGBClassifier # or XGBRegressor
model = XGBClassifier() # or XGBRegressor
# X and y are input and target arrays of numeric variables
model.fit(X,y)
plot_importance(model, importance_type = 'gain') # other options available
plt.show()
# if you need a dictionary
model.get_booster().get_score(importance_type = 'gain')