XGBoost Model Analysis

This notebook can be used to load and analysis model learnt from all xgboost bindings, including distributed training.


In [ ]:
import sys
import os
%matplotlib inline

Please change the pkg_path and model_file to be correct path


In [ ]:
pkg_path = '../../python-package/'
model_file = 's3://my-bucket/xgb-demo/model/0002.model'
sys.path.insert(0, pkg_path)
import xgboost as xgb

Plot the Feature Importance


In [ ]:
# plot the first two trees.
bst = xgb.Booster(model_file=model_file)
xgb.plot_importance(bst)

Plot the First Tree


In [ ]:
tree_id = 0
xgb.to_graphviz(bst, tree_id)