BGlib.be.analysis.utils.tree.ClusterTree¶
- class BGlib.be.analysis.utils.tree.ClusterTree(linkage_pairing, labels, distances=None, centroids=None)[source]¶
Bases:
object
Creates a tree representation from the provided linkage pairing. Useful for clustering
- Parameters:
linkage_pairing (2D unsigned int numpy array or list) – Linkage pairing that describes a tree structure. The matrix should result in a single tree apex.
labels (1D unsigned int numpy array or list) – Labels assigned to each of the positions in the main dataset. Eg. Labels from clustering
distances ((Optional) 1D numpy float array or list) – Distances between clusters
centroids ((Optional) 2D numpy array) – Mean responses for each of the clusters. These will be propagated up
Methods
Attributes
this list maintains pointers to the nodes pertaining to that cluster id for quick look-ups By default this lookup table just contains the number indices of these clusters.
the labels for the leaf nodes need to be calculated manually from the provided labels Populate the lowest level nodes / leaves first:
- __str__()[source]¶
Overrides the to string representation. Prints the names of the node and its children. Not very useful for large trees
- Return type:
String representation of the tree structure
- centroids¶
this list maintains pointers to the nodes pertaining to that cluster id for quick look-ups By default this lookup table just contains the number indices of these clusters. They will be replaced with node objects as and when the objects are created
- labels¶
the labels for the leaf nodes need to be calculated manually from the provided labels Populate the lowest level nodes / leaves first: