Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions eli5/xgboost.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,18 +356,19 @@ def _parse_tree_dump(text_dump):
def _parse_dump_line(line):
# type: (str) -> Tuple[int, Dict[str, Any]]
branch_match = re.match(
'^(\t*)(\d+):\[([^<]+)<([^\]]+)\] '
'^(\t*)(\d+):\[([^<]+)<?([^\]]*)\] '
'yes=(\d+),no=(\d+),missing=(\d+),'
'gain=([^,]+),cover=(.+)$', line)
if branch_match:
tabs, node_id, feature, condition, yes, no, missing, gain, cover = \
branch_match.groups()
depth = len(tabs)
split_condition = float(condition) if condition else 0.
return depth, {
'depth': depth,
'nodeid': int(node_id),
'split': feature,
'split_condition': float(condition),
'split_condition': split_condition,
'yes': int(yes),
'no': int(no),
'missing': int(missing),
Expand Down