add flag variable in Python get_fscore() to control printing
This commit is contained in:
parent
1d8fc6280c
commit
84b82ab55f
@ -510,14 +510,16 @@ class Booster(object):
|
|||||||
res.append(str(sarr[i]))
|
res.append(str(sarr[i]))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def get_fscore(self, fmap=''):
|
def get_fscore(self, fmap='',verbose = False):
|
||||||
"""
|
"""
|
||||||
Get feature importance of each feature.
|
Get feature importance of each feature.
|
||||||
"""
|
"""
|
||||||
trees = self.get_dump(fmap)
|
trees = self.get_dump(fmap)
|
||||||
fmap = {}
|
fmap = {}
|
||||||
for tree in trees:
|
for tree in trees:
|
||||||
sys.stdout.write(str(tree) + '\n')
|
if verbos is True:
|
||||||
|
sys.stdout.write(str(tree) + '\n')
|
||||||
|
|
||||||
for l in tree.split('\n'):
|
for l in tree.split('\n'):
|
||||||
arr = l.split('[')
|
arr = l.split('[')
|
||||||
if len(arr) == 1:
|
if len(arr) == 1:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user