pasteur.hierarchy.find_smallest_group

pasteur.hierarchy.find_smallest_group#

pasteur.hierarchy.find_smallest_group(counts, parent)[source]#

Finds groups a, b which when combined form c, where c is the smallest group that can be formed by any two nodes in the tree, which are valid to merge.

Returns the parent node of a and b, a, b, and the size of the resulting group.

Can be used with merge_groups_in_node() and prune_tree() to merge the two smallest groups in the tree.

parent represents a tree over the hierarchy of the attribute. Children can either be lists (nodes), sets (leafs, groups), or None (placeholders, common values, shouldn’t be merged).

Return type:

tuple[list, set, set, float]