Tree.make_tree

Search for the best tree of a given distance matrix. [source]
Parameters:
dm : array_like
  Distance matrix saved in an numpy array.

leaf_labels :
array_like
  An array with all leaf labels.

processes :
int
  Number of processes to be used in the paralelization of this function.

n_trees :
int default = '1000'
  Number of trees to be generated during the random search.

plot_tree :
bool default = True
  Plot the new best tree on the screen if plot_tree == True. Good for testing, but not recomended for large size searches since saving all images memmory may be an issue.
Returns:
inner_node_dict : dictionary
  Dictionary with all inner node connections.

leaf_node_dict :
dictionary
  Dictionary with all leaf node connections to their respective inner nodes.
Outputs:
gray_tree : png
  For every new best tree found, the gray_tree image is updated inside the tree folder.
leaf_node_dict : txt file
  For every new best tree found, the leaf_node_dict is updated inside the dict folder.
inner_node_dict : txt file
  For every new best tree found, the inner_node_dict is updated inside the dict folder.
See also:
tree.make_color_tree
 Make a color tree, given a list of cluster labels.

tree.make_clusters
 Make any given number of clusters, given a respective tree.

Example:

# Imports
from zgli.tree import make_tree

# Make tree
inner_node_dict, leaf_dict = make_tree(dm, leaf_labels, processes = 10, n_trees = 500, plot_tree = True)