'Update the variational distributions for the means'

def _update_means(self, X, z):

    n_features = X.shape[1]
    for k in range(self.n_components):
        if (self.covariance_type in ['spherical', 'diag']):
            num = np.sum((z.T[k].reshape(((-1), 1)) * X), axis=0)
            num *= self.precs_[k]
            den = (1.0 + (self.precs_[k] * np.sum(z.T[k])))
            self.means_[k] = (num / den)
        elif (self.covariance_type in ['tied', 'full']):
            if (self.covariance_type == 'tied'):
                cov = self.precs_
            else:
                cov = self.precs_[k]
            den = (np.identity(n_features) + (cov * np.sum(z.T[k])))
            num = np.sum((z.T[k].reshape(((-1), 1)) * X), axis=0)
            num = np.dot(cov, num)
            self.means_[k] = linalg.lstsq(den, num)[0]
