turned-in version of EM and k-means