pasteur.hierarchy.merge_groups_in_node

pasteur.hierarchy.merge_groups_in_node#

pasteur.hierarchy.merge_groups_in_node(node, a, b)[source]#

Computes c = a intersection b and inserts it into node, by replacing a with c and removing b.

This is valid for both ordinal nodes, where a, b, are next to each other, and categorical nodes, where b might be in any place.

If len(node) == 2, node won’t be replaced its child due to python limitations. prune_tree() can be called to replace all nodes where len(node) == 1 with their children.