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
bcd77003
Commit
bcd77003
authored
Mar 21, 2018
by
JiechengZhao
Committed by
Guolin Ke
Mar 21, 2018
Browse files
[python] use raw string to show label (#1274)
parent
b0d2f826
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
python-package/lightgbm/plotting.py
python-package/lightgbm/plotting.py
+4
-4
No files found.
python-package/lightgbm/plotting.py
View file @
bcd77003
...
@@ -274,10 +274,10 @@ def _to_graphviz(tree_info, show_info, feature_names,
...
@@ -274,10 +274,10 @@ def _to_graphviz(tree_info, show_info, feature_names,
label
=
'split_feature_name:'
+
str
(
feature_names
[
root
[
'split_feature'
]])
label
=
'split_feature_name:'
+
str
(
feature_names
[
root
[
'split_feature'
]])
else
:
else
:
label
=
'split_feature_index:'
+
str
(
root
[
'split_feature'
])
label
=
'split_feature_index:'
+
str
(
root
[
'split_feature'
])
label
+=
'
\n
threshold:'
+
str
(
root
[
'threshold'
])
label
+=
r
'\nthreshold:'
+
str
(
root
[
'threshold'
])
for
info
in
show_info
:
for
info
in
show_info
:
if
info
in
{
'split_gain'
,
'internal_value'
,
'internal_count'
}:
if
info
in
{
'split_gain'
,
'internal_value'
,
'internal_count'
}:
label
+=
'
\n
'
+
info
+
':'
+
str
(
root
[
info
])
label
+=
r
'\n'
+
info
+
':'
+
str
(
root
[
info
])
graph
.
node
(
name
,
label
=
label
)
graph
.
node
(
name
,
label
=
label
)
if
root
[
'decision_type'
]
==
'<='
:
if
root
[
'decision_type'
]
==
'<='
:
l_dec
,
r_dec
=
'<='
,
'>'
l_dec
,
r_dec
=
'<='
,
'>'
...
@@ -290,9 +290,9 @@ def _to_graphviz(tree_info, show_info, feature_names,
...
@@ -290,9 +290,9 @@ def _to_graphviz(tree_info, show_info, feature_names,
else
:
# leaf
else
:
# leaf
name
=
'leaf'
+
str
(
root
[
'leaf_index'
])
name
=
'leaf'
+
str
(
root
[
'leaf_index'
])
label
=
'leaf_index:'
+
str
(
root
[
'leaf_index'
])
label
=
'leaf_index:'
+
str
(
root
[
'leaf_index'
])
label
+=
'
\n
leaf_value:'
+
str
(
root
[
'leaf_value'
])
label
+=
r
'\nleaf_value:'
+
str
(
root
[
'leaf_value'
])
if
'leaf_count'
in
show_info
:
if
'leaf_count'
in
show_info
:
label
+=
'
\n
leaf_count:'
+
str
(
root
[
'leaf_count'
])
label
+=
r
'\nleaf_count:'
+
str
(
root
[
'leaf_count'
])
graph
.
node
(
name
,
label
=
label
)
graph
.
node
(
name
,
label
=
label
)
if
parent
is
not
None
:
if
parent
is
not
None
:
graph
.
edge
(
parent
,
name
,
decision
)
graph
.
edge
(
parent
,
name
,
decision
)
...
...
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