Alien-XGBoost
view release on metacpan or search on metacpan
xgboost/demo/distributed-training/plot_model.ipynb view on Meta::CPAN
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# XGBoost Model Analysis\n",
"\n",
"This notebook can be used to load and analysis model learnt from all xgboost bindings, including distributed training. "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import sys\n",
"import os\n",
"%matplotlib inline "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Please change the ```pkg_path``` and ```model_file``` to be correct path"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"pkg_path = '../../python-package/'\n",
"model_file = 's3://my-bucket/xgb-demo/model/0002.model'\n",
"sys.path.insert(0, pkg_path)\n",
"import xgboost as xgb"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Plot the Feature Importance"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# plot the first two trees.\n",
"bst = xgb.Booster(model_file=model_file)\n",
"xgb.plot_importance(bst)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
( run in 1.216 second using v1.01-cache-2.11-cpan-2398b32b56e )