summaryrefslogtreecommitdiff
path: root/examples/clustering/clustering_tree.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/clustering/clustering_tree.py')
-rw-r--r--examples/clustering/clustering_tree.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/examples/clustering/clustering_tree.py b/examples/clustering/clustering_tree.py
index e9b0f74..47425c3 100644
--- a/examples/clustering/clustering_tree.py
+++ b/examples/clustering/clustering_tree.py
@@ -13,8 +13,8 @@ F\t-1.04\t-1.11\t0.87\t-0.14\t-0.80\t1.74\t0.48
G\t-1.57\t-1.17\t1.29\t0.23\t-0.20\t1.17\t0.26
H\t-1.53\t-1.25\t0.59\t-0.30\t0.32\t1.41\t0.77
"""
-print "Example numerical matrix"
-print matrix
+print("Example numerical matrix")
+print(matrix)
# #Names col1 col2 col3 col4 col5 col6 col7
# A -1.23 -0.81 1.79 0.78 -0.42 -0.69 0.58
# B -1.76 -0.94 1.16 0.36 0.41 -0.35 1.12
@@ -30,7 +30,7 @@ print matrix
# numerical matrix. We use the text_array argument to link the tree
# with numerical matrix.
t = ClusterTree("(((A,B),(C,(D,E))),(F,(G,H)));", text_array=matrix)
-print "Example tree", t
+print("Example tree", t)
# /-A
# /--------|
# | \-B
@@ -49,18 +49,18 @@ print "Example tree", t
# Now we can ask the numerical profile associated to each node
A = t.search_nodes(name='A')[0]
-print "A associated profile:\n", A.profile
+print("A associated profile:\n", A.profile)
# [-1.23 -0.81 1.79 0.78 -0.42 -0.69 0.58]
#
# Or we can ask for the mean numerical profile of an internal
# partition, which is computed as the average of all vectors under the
# the given node.
cluster = t.get_common_ancestor("E", "A")
-print "Internal cluster mean profile:\n", cluster.profile
+print("Internal cluster mean profile:\n", cluster.profile)
#[-1.574 -0.686 1.048 -0.012 -0.118 0.614 0.728]
#
# We can also obtain the std. deviation vector of the mean profile
-print "Internal cluster std deviation profile:\n", cluster.deviation
+print("Internal cluster std deviation profile:\n", cluster.deviation)
#[ 0.36565558 0.41301816 0.40676283 0.56211743 0.50704635 0.94949671
# 0.26753691]
# If would need to re-link the tree to a different matrix or use
@@ -96,7 +96,7 @@ H\t0\t0\t0\t0\t0\t0\t0
# obviated from association.
t.children[0].link_to_arraytable(matrix_ones)
t.children[1].link_to_arraytable(matrix_zeros)
-print "A profile (using matrix with 1s", (t&"A").profile
-print "H profile (using matrix with 0s)", (t&"H").profile
+print("A profile (using matrix with 1s", (t&"A").profile)
+print("H profile (using matrix with 0s)", (t&"H").profile)
#A profile (using matrix with 1s [ 1. 1. 1. 1. 1. 1. 1.]
#H profile (using matrix with 0s) [ 0. 0. 0. 0. 0. 0. 0.]