def _calculate_gain(tree, node_id):
S, nS, S1, nS1, S2, nS2 = _get_variables_for_entropy_calculation(tree, node_id)
return _calculate_entropy(S) \
- S1.sum() / S.sum() * _calculate_entropy(S1) \
- S2.sum() / S.sum() * _calculate_entropy(S2)
评论列表
文章目录