diff --git a/wrapper/xgboost.py b/wrapper/xgboost.py index 53bec0a69..51200f8ed 100644 --- a/wrapper/xgboost.py +++ b/wrapper/xgboost.py @@ -510,14 +510,16 @@ class Booster(object): res.append(str(sarr[i])) return res - def get_fscore(self, fmap=''): + def get_fscore(self, fmap='',verbose = False): """ Get feature importance of each feature. """ trees = self.get_dump(fmap) fmap = {} 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'): arr = l.split('[') if len(arr) == 1: