dist4 = (
            (cluster[j][0] - c[3][0]) ** 2
            + (cluster[j][1] - c[3][1]) ** 2
            + (cluster[j][2] - c[3][2]) ** 2
            + (cluster[j][3] - c[3][3]) ** 2
            + (cluster[j][4] - c[3][4]) ** 2
        ) * 0.5
        dist5 = (
            (cluster[j][0] - c[4][0]) ** 2
            + (cluster[j][1] - c[4][1]) ** 2
            + (cluster[j][2] - c[4][2]) ** 2
            + (cluster[j][3] - c[4][3]) ** 2
            + (cluster[j][4] - c[4][4]) ** 2
        ) * 0.5

        min_dist = HC.median5_min(dist1, dist2, dist3, dist4, dist5)

        # print 'Minimum is :', min_dist
        if min_dist == dist1:
            phi[j] = 0
            cluster1.append(cluster[j])
        elif min_dist == dist2:
            phi[j] = 1
            cluster2.append(cluster[j])
        elif min_dist == dist3:
            phi[j] = 2
            cluster3.append(cluster[j])
        elif min_dist == dist4:
            phi[j] = 3
            cluster4.append(cluster[j])
        elif min_dist == dist5:
Exemple #2
0
                 (cluster[j][2] - c[0][2])**2 + (cluster[j][3] - c[0][3])**2 +
                 (cluster[j][4] - c[0][4])**2) * 0.5
        dist2 = ((cluster[j][0] - c[1][0])**2 + (cluster[j][1] - c[1][1])**2 +
                 (cluster[j][2] - c[1][2])**2 + (cluster[j][3] - c[1][3])**2 +
                 (cluster[j][4] - c[1][4])**2) * 0.5
        dist3 = ((cluster[j][0] - c[2][0])**2 + (cluster[j][1] - c[2][1])**2 +
                 (cluster[j][2] - c[2][2])**2 + (cluster[j][3] - c[2][3])**2 +
                 (cluster[j][4] - c[2][4])**2) * 0.5
        dist4 = ((cluster[j][0] - c[3][0])**2 + (cluster[j][1] - c[3][1])**2 +
                 (cluster[j][2] - c[3][2])**2 + (cluster[j][3] - c[3][3])**2 +
                 (cluster[j][4] - c[3][4])**2) * 0.5
        dist5 = ((cluster[j][0] - c[4][0])**2 + (cluster[j][1] - c[4][1])**2 +
                 (cluster[j][2] - c[4][2])**2 + (cluster[j][3] - c[4][3])**2 +
                 (cluster[j][4] - c[4][4])**2) * 0.5

        min_dist = HC.median5_min(dist1, dist2, dist3, dist4, dist5)

        #print 'Minimum is :', min_dist
        if min_dist == dist1:
            phi[j] = 0
            cluster1.append(cluster[j])
        elif min_dist == dist2:
            phi[j] = 1
            cluster2.append(cluster[j])
        elif min_dist == dist3:
            phi[j] = 2
            cluster3.append(cluster[j])
        elif min_dist == dist4:
            phi[j] = 3
            cluster4.append(cluster[j])
        elif min_dist == dist5: