Exemple #1
0

clink_cluster=cluster



""" Complete-link hierarchical clustering """


while len(clink_cluster)!=4:
	for i in range(0,len(clink_cluster)):
		for j in range(0,len(clink_cluster)):
			if clink_cluster[i]==clink_cluster[j]:
				continue
			else:
				tdist=HC.complete_link(clink_cluster[i],clink_cluster[j])
				if tdist <= min:
					min=tdist
					#print 'min at this point is :', min
					c_cluster1=clink_cluster[i]
					c_cluster2=clink_cluster[j]
	
	#print 'Cluster 1 going to be removed is :', c_cluster1
	#print 'Cluster 2 going to be removed is :', c_cluster2
	clink_cluster.remove(c_cluster1)
	clink_cluster.remove(c_cluster2)
	clink_cluster.append(c_cluster1 + c_cluster2)
	#print 'Clusters at this stage are :', clink_cluster
	min=99999