pasteur.hierarchy

pasteur.hierarchy#

Description

Highly experimental and unpublished class for rebalancing Stratified Values with Differential Privacy.

@TODO: Documentation.

Functions

create_node_to_group_map(tree, grouping[, ofs])

Traverses tree and creates an array which maps nodes to groups such that:

create_tree(node, common[, ofs, n])

Receives the top node of the tree of a hierarchical attribute and converts it into the same tree structure, where the leaves have been replaced by bucket groups, with each bucket group containing the node it replaced.

find_smallest_group(counts, parent)

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.

generate_domain_list(max_domain, common[, ...])

Takes in a max_domain value and uses it to produce a new increasing domain list, based on u and fixed.

get_children(tree)

get_common_groups(tree[, ofs])

get_common_sizes(tree)

get_group_size(counts, g)

Returns the sum of the sizes of the buckets included in set g.

get_len(tree)

make_grouping(counts, head, common)

merge_groups_in_node(node, a, b)

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

print_group(counts, g)

Converts the group into a string representation: (False, False, True, True, False) -> (2,3)

print_tree(node)

Converts a tree into a human ledgible representation.

prune_tree(tree)

Replaces all nodes in the tree where len(node) == 1 with their children.

rebalance_attributes(counts, attrs[, warn])

Classes

CatNode([iterable])

CommonNode([iterable])

OrdNode([iterable])

RebalancedValue(counts, col, *[, ...])