def evaluate(clust_dists, clustidx, X):
    results = {}
    sum = 0
    count = 0
    clustsum = [0 for i in range(len(clust_dists[0]))]
    clustcount = [0 for i in range(len(clust_dists[0]))]
    clustmean = [0 for i in range(len(clust_dists[0]))]
    for i in range(len(clustidx)):
        sum += clust_dists[i][clustidx[i]]
        count += 1
        clustsum[clustidx[i]] += clust_dists[i][clustidx[i]]
        clustcount[clustidx[i]] += 1
    averagedist = (float(sum) / count)
    results['meandist'] = averagedist
    for i in range(len(clust_dists[0])):
        clustmean[i] = (float(clustsum[i]) / clustcount[i])
    return (results, clustmean)
def evaluate(clust_dists, clustidx, X):
    results = {}
    sum = 0
    count = 0
    clustsum = [0 for i in range(len(clust_dists[0]))]
    clustcount = [0 for i in range(len(clust_dists[0]))]
    clustmean = [0 for i in range(len(clust_dists[0]))]
    for i in range(len(clustidx)):
        sum += clust_dists[i][clustidx[i]]
        count += 1
        clustsum[clustidx[i]] += clust_dists[i][clustidx[i]]
        clustcount[clustidx[i]] += 1
    averagedist = (float(sum) / count)
    results['meandist'] = averagedist
    for i in range(len(clust_dists[0])):
        clustmean[i] = (float(clustsum[i]) / clustcount[i])
    return (results, clustmean)