Machine Learning, Clustering, Expectation Maximization, Gaussian Mixture Model, Image Clustering.
len(data[0]) # to get dimention of data n_data = len(data) covariances = np.zeros((n_clusters, dimension, dimension)) for k in range(n_clusters): weighted_sum = reduce (lambda x, i :x + resp[i,k] * np.outer((data[i]-means[k]), (data[i]- means[k]).T), range(n_data), np.zeros((dimension, dimension)))