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
7f94fd9c
Commit
7f94fd9c
authored
Apr 27, 2017
by
wxchan
Committed by
Guolin Ke
Apr 27, 2017
Browse files
fix feature importance (#468)
parent
edd618bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
python-package/lightgbm/basic.py
python-package/lightgbm/basic.py
+5
-4
No files found.
python-package/lightgbm/basic.py
View file @
7f94fd9c
...
...
@@ -1653,10 +1653,11 @@ class Booster(object):
def
dfs
(
root
):
if
"split_feature"
in
root
:
if
importance_type
==
'split'
:
ret
[
root
[
"split_feature"
]]
+=
1
elif
importance_type
==
'gain'
:
ret
[
root
[
"split_feature"
]]
+=
root
[
"split_gain"
]
if
root
[
'split_gain'
]
>
0
:
if
importance_type
==
'split'
:
ret
[
root
[
"split_feature"
]]
+=
1
elif
importance_type
==
'gain'
:
ret
[
root
[
"split_feature"
]]
+=
root
[
"split_gain"
]
dfs
(
root
[
"left_child"
])
dfs
(
root
[
"right_child"
])
for
tree
in
dump_model
[
"tree_info"
]:
...
...
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