Machine Learning, Clustering, Expectation Maximization, Gaussian Mixture Model, Image Clustering.
size (n_cluster) def _get_means( data, resp, counts): n_clusters = len(counts) n_data = len(data) means = np.zeros((n_clusters, len(data[0]))) for k in range(n_clusters): weighted_sum = reduce(lambda x,i : x + resp[i,k]*data[i], range(n_data), 0.0) means[k] = weighted_sum/counts[k] return means