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 k-nearest neighbors density estimate and connectivity graph.

Warning

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

Parameters:

density : list[float] or numpy array

The observations removed as background points at each successively higher density level.

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])
get_clusters([method, fill_background]) Generic function for retrieving 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.