[Breaking] Don't save leaf child count in JSON. (#6094)

The field is deprecated and not used anywhere in XGBoost.
This commit is contained in:
Jiaming Yuan
2020-09-08 11:11:13 +08:00
committed by GitHub
parent 5994f3b14c
commit e5d40b39cd
3 changed files with 1 additions and 20 deletions

View File

@@ -18,7 +18,6 @@ class Tree:
_loss_chg = 0
_sum_hess = 1
_base_weight = 2
_child_cnt = 3
def __init__(self, tree_id: int, nodes, stats):
self.tree_id = tree_id
@@ -37,10 +36,6 @@ class Tree:
'''Base weight of a node.'''
return self.stats[node_id][self._base_weight]
def num_children(self, node_id: int):
'''Number of children of a node.'''
return self.stats[node_id][self._child_cnt]
def split_index(self, node_id: int):
'''Split feature index of node.'''
return self.nodes[node_id][self._ind]
@@ -138,7 +133,6 @@ class Model:
base_weights = tree['base_weights']
loss_changes = tree['loss_changes']
sum_hessian = tree['sum_hessian']
leaf_child_counts = tree['leaf_child_counts']
stats = []
nodes = []
@@ -152,7 +146,7 @@ class Model:
])
stats.append([
loss_changes[node_id], sum_hessian[node_id],
base_weights[node_id], leaf_child_counts[node_id]
base_weights[node_id]
])
tree = Tree(tree_id, nodes, stats)