Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
7ab94e6b
Commit
7ab94e6b
authored
Mar 14, 2019
by
Nikita Titov
Committed by
Guolin Ke
Mar 14, 2019
Browse files
[examples] updated tree index with categorical feature (#2044)
* updated gitignore * updated tree index with cat feature
parent
8d6666e0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
.gitignore
.gitignore
+4
-0
examples/python-guide/plot_example.py
examples/python-guide/plot_example.py
+4
-4
No files found.
.gitignore
View file @
7ab94e6b
...
@@ -393,3 +393,7 @@ lightgbm.Rcheck/
...
@@ -393,3 +393,7 @@ lightgbm.Rcheck/
# Files generated by aspell
# Files generated by aspell
**/*.bak
**/*.bak
# GraphViz artifacts
*.gv
*.gv.*
examples/python-guide/plot_example.py
View file @
7ab94e6b
...
@@ -50,10 +50,10 @@ print('Plotting feature importances...')
...
@@ -50,10 +50,10 @@ print('Plotting feature importances...')
ax
=
lgb
.
plot_importance
(
gbm
,
max_num_features
=
10
)
ax
=
lgb
.
plot_importance
(
gbm
,
max_num_features
=
10
)
plt
.
show
()
plt
.
show
()
print
(
'Plotting
8
4th tree...'
)
# one tree use categorical feature to split
print
(
'Plotting
5
4th tree...'
)
# one tree use categorical feature to split
ax
=
lgb
.
plot_tree
(
gbm
,
tree_index
=
8
3
,
figsize
=
(
20
,
8
),
show_info
=
[
'split_gain'
])
ax
=
lgb
.
plot_tree
(
gbm
,
tree_index
=
5
3
,
figsize
=
(
15
,
15
),
show_info
=
[
'split_gain'
])
plt
.
show
()
plt
.
show
()
print
(
'Plotting
8
4th tree with graphviz...'
)
print
(
'Plotting
5
4th tree with graphviz...'
)
graph
=
lgb
.
create_tree_digraph
(
gbm
,
tree_index
=
8
3
,
name
=
'Tree
8
4'
)
graph
=
lgb
.
create_tree_digraph
(
gbm
,
tree_index
=
5
3
,
name
=
'Tree
5
4'
)
graph
.
render
(
view
=
True
)
graph
.
render
(
view
=
True
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment