# level_set_tree.LevelSetTree¶

class level_set_tree.LevelSetTree(density=[], levels=[])

Level Set Tree attributes and methods. The level set tree is a collection of connected components organized hierarchically, based on a density estimate and connectivity graph.

Warning

LevelSetTree objects should not generally be instantiated directly, because they will contain empty node hierarchies. Use the constructors construct_tree() or construct_tree_from_graph() to instantiate a LevelSetTree model.

Parameters: density : list[float] or numpy array Estimated probability density for each point. This defines the order in which the points are removed from the similarity graph as the Level Set Tree is grown upward from the root. levels : array_like Probability density levels at which to find clusters. Defines the vertical resolution of the tree.
__init__(density=[], levels=[])

Methods

 __init__([density, levels]) branch_partition() Partition the input data. get_clusters([method, fill_background]) Retrieve cluster labels from the level set tree. get_leaf_nodes() Return the indices of leaf nodes in the level set tree. plot([form, horizontal_spacing, ...]) Plot the level set tree as a dendrogram and return coordinates and colors of the branches. prune(threshold) Prune the tree by recursively merging small leaf nodes into larger sibling nodes. save(filename) Save a level set tree object to file.