Skip to content

add weighted sampling

Scott Workman requested to merge dev/weighted_sampling into main

partially addresses #8

This pretty significantly changes the internals of NestedPool. I created a tree representation where nodes are dictionaries, children are list of dicts (when a node, otherwise a flat list when a leaf). You can still initialize from a nested list, and the tree structure is created automatically (using uniform weights, i.e., None, for nodes). Ultimately, subdivide can now accept a weight dictionary and sampling can use weights, when available, to choose which branch of the tree to follow. I realize there are many ways you could have probably done this and this implementation probably requires a heavy review. That said, we should probably use networkx or something that already exists.

Edited by Scott Workman

Merge request reports