Generative Model, Walkthrough, Data Science.
range(n_classes): likelihood = scipy.stats.multivariate_normal.pdf( x, mean=means[i], cov=covariances[i] ) posteriors.append(likelihood*priors[i]) probabilities = np.array(posteriors).T # convert list of n_classes of (n,) normalized_p = probabilities/np.sum(probabilities,axis=1,keepdims=True)