(self, data)
return logobs
Compute log observation probabilities under GMM.
        Args:
            data: A N x D array of points.
        Returns:
            logobs: A N x K array of log probabilities (for each point
                on each cluster).
Compute log observation probabilities under GMM.
        Args:
            data: A N x D array of points.
        Returns:
            logobs: A N x K array of log probabilities (for each point
                on each cluster).
Compute log observation probabilities under GMM . Args : data : A N x D array of points . Returns : logobs : A N x K array of log probabilities ( for each point on each cluster ) .
def estep(self, data):
        """
        Compute log observation probabilities under GMM.
        Args:
            data: A N x D array of points.
        Returns:
            logobs: A N x K array of log probabilities (for each point
                on each cluster).
        """
        # Constants.
        N, D = data.shape
        K = self.sigma.shape[0]

        logobs = -0.5*np.ones((N, K))*D*np.log(2*np.pi)
        for i in range(K):
            mu, sigma = self.mu[i], self.sigma[i]
            L = scipy.linalg.cholesky(sigma, lower=True)
            logobs[:, i] -= np.sum(np.log(np.diag(L)))

            diff = (data - mu).T
            soln = scipy.linalg.solve_triangular(L, diff, lower=True)
            logobs[:, i] -= 0.5*np.sum(soln**2, axis=0)

        logobs += self.logmass.T
        return logobs
def estep ( self , data ) : # Constants. N , D = data . shape K = self . sigma . shape [ 0 ] logobs = - 0.5 * np . ones ( ( N , K ) ) * D * np . log ( 2 * np . pi ) for i in range ( K ) : mu , sigma = self . mu [ i ] , self . sigma [ i ] L = scipy . linalg . cholesky ( sigma , lower = True ) logobs [ : , i ] -= np . sum ( np . log ( np . diag ( L ) ) ) diff = ( data - mu ) . T soln = scipy . linalg . solve_triangular ( L , diff , lower = True ) logobs [ : , i ] -= 0.5 * np . sum ( soln ** 2 , axis = 0 ) logobs += self . logmass . T return logobs