Skip to content

Commit

Permalink
Update xgb.get_importances for non-string feature names
Browse files Browse the repository at this point in the history
  • Loading branch information
mxbi authored Dec 24, 2019
1 parent b8a2dda commit 74bc457
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mlcrate/xgb.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ def get_importances(model, features):
importance -- A list of (feature, importance) tuples representing sorted importance
"""

features = [str(f) for f in features]

for feature in features:
assert '\n' not in feature and '\t' not in feature, "\\n and \\t cannot be in feature names"

Expand Down

0 comments on commit 74bc457

Please sign in to comment.