Skip to content

Commit

Permalink
[examples] updated tree index with categorical feature (#2044)
Browse files Browse the repository at this point in the history
* updated gitignore

* updated tree index with cat feature
  • Loading branch information
StrikerRUS authored and guolinke committed Mar 14, 2019
1 parent 8d6666e commit 7ab94e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -393,3 +393,7 @@ lightgbm.Rcheck/

# Files generated by aspell
**/*.bak

# GraphViz artifacts
*.gv
*.gv.*
8 changes: 4 additions & 4 deletions examples/python-guide/plot_example.py
Expand Up @@ -50,10 +50,10 @@
ax = lgb.plot_importance(gbm, max_num_features=10)
plt.show()

print('Plotting 84th tree...') # one tree use categorical feature to split
ax = lgb.plot_tree(gbm, tree_index=83, figsize=(20, 8), show_info=['split_gain'])
print('Plotting 54th tree...') # one tree use categorical feature to split
ax = lgb.plot_tree(gbm, tree_index=53, figsize=(15, 15), show_info=['split_gain'])
plt.show()

print('Plotting 84th tree with graphviz...')
graph = lgb.create_tree_digraph(gbm, tree_index=83, name='Tree84')
print('Plotting 54th tree with graphviz...')
graph = lgb.create_tree_digraph(gbm, tree_index=53, name='Tree54')
graph.render(view=True)

0 comments on commit 7ab94e6

Please sign in to comment.