Running hierarchical clustering over input data file
Code: "clustering_hierarchical_spmf.py". Programming language: Python DMelt Version 1. Last modified: 12/08/2015. License: Pro
https://datamelt.org/code/cache/clustering_hierarchical_spmf_8576.py
To run this script using the DMelt IDE, copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.




from ca.pfv.spmf.algorithms.clustering.hierarchical_clustering  import AlgoHierarchicalClustering 

# create input data
data="""1 2 3 4
1 6 8 8
1 2 3 3
2 4 5 5
4 7 8 7
7 6 8 9
4 4 3 3
2 2 5 5
7 5 5 5
5 6 8 9 
"""
file = open("data.txt", "w")
file.write(data)
file.close()

out="output.txt"
alg=AlgoHierarchicalClustering()
alg.runAlgorithm("data.txt", 4) # maxdistance =4 
# alg.printStatistics()
alg.saveToFile(out)

print "Clusters="
print open(out).read()

You see the box below because you did not login.