I've trained an XGBoost model and used plot_importance() to plot which features are the most important in the trained model. Although, the numbers in plot have several decimal values which floods the plot and does not fit into the plot.
I have searched for plot formatting options, but I only found how to format axis (tried formatting X axis in hope that it would format corresponding axes as well)
I work in a Jupyter Noteboook (if that makes any difference). The code is as follows:
xg_reg = xgb.XGBClassifier(
objective = 'binary:logistic',
colsample_bytree = 0.4,
learning_rate = 0.01,
max_depth = 15,
alpha = 0.1,
n_estimators = 5,
subsample = 0.5,
scale_pos_weight = 4
)
xg_reg.fit(X_train, y_train)
preds = xg_reg.predict(X_test)
ax = xgb.plot_importance(xg_reg, max_num_features=3, importance_type='gain', show_values=True)
fig = ax.figure
fig.set_size_inches(10, 3)
Is there something I'm missing? Are there any formatting functions or parameters to pass?
I would like to be able to format feature importance scores, or at least drop the decimal part (e.g. "25" instead of "25.66521"). Attached a current plot below.