Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def calc_dendrograms(HC, D, linkage_type='single'):
linkage_types = { 'single' : fc.single,
'complete' : fc.complete,
'average' : fc.average,
'weighted' : fc.weighted,
'centroid' : fc.centroid,
'median' : fc.median,
'ward' : fc.ward };
T = {};
print "Calculating linkages. This will take a while!";
nk = len(D.keys());
for (i, dk) in enumerate(D.keys()):
print "\r%d/%d" % (i+1, nk),
sys.stdout.flush();
L = linkage_types[linkage_type](D[dk]);
T[dk] = construct_dendrogram(L, HC[dk]);
#efor