def maximization(data, probabilities):
    m, n = data.shape
numOfClusters = probabilities.shape[1]
means = np.zeros((numOfClusters, n))
covs = np.zeros((numOfClusters, n, n))
priors = np.zeros((numOfClusters, 1))
for i in range(0, numOfClusters):
    priors[i, 0] = np.sum(probabilities[:, (i)]) / m
for j in range(0, m):
    means[i] += probabilities[j, i] * data[(j), :]
means[i] /= np.sum(probabilities[:, (i)])
for i in range(0, numOfClusters):
    for j in range(0, m):
        vec = np.reshape(data[(j), :] - means[(i), :], (n, 1))
covs[i] += probabilities[j, i] * np.multiply(vec, vec.T)
covs[i] /= np.sum(probabilities[:, (i)])
return [means, covs, priors]
GMM - loglikelihood isn't monotonic