Module: tfp.experimental.lazybones.utils

Utility functions for tfp.experimental.lazybones.


class HashableWeakRef: weakref.ref which makes wrapped object hashable.

class ObjectProxy: Like wrapt.ObjectProxy except using our way.

class SpecialMethods: Special methods to intercept.

class WeakKeyDictionary: WeakKeyDictionary.

class WeakSet: WeakSet.


distribution_measure(...): Returns getattr(distribution) when vertexes take on values.

get_leaves(...): Returns all childless descendants ("leaves") of (iterable) ancestors.

get_roots(...): Returns all parentless ancestors ("roots") of (iterable) descendants.

is_any_ancestor(...): Returns True if any member of v has an ancestor in ancestors.

iter_edges(...): Returns iter over all (parent, child) edges in leaves' ancestors.

log_prob(...): Returns log_prob when vertexes take on values.

plot_graph(...): Plots leaves and ancestors. (See help(nx.draw_networkx) for kwargs).

prob(...): Returns prob when vertexes take on values.