Example #1
0
def do_iris_HAC():
    numvars, names, data, labels = read_data('iris.cluster.txt')
    DE = HAC(data, .1)
    data = []
    for grouping in DE:
        if grouping[0] != 0:
            K = grouping[2]
            K.compute_means()
            data.append((grouping[1], K.error()))
            print grouping[0], grouping[1], K.error()
            for cluster in K.clusters:
                cluster.indices.sort()
                print cluster.indices
    plot = Plot()
    plot.title = 'SSE as a function of number of clusters in HAC'
    plot.append(Points(data, style='lines'))
    plot.write('hac_clusters.gpi')