Created
January 22, 2020 19:07
-
-
Save ortsed/9402bdd623e9edbc0d4222c6436d1582 to your computer and use it in GitHub Desktop.
Multivariate Gaussian
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def multivariateGaussian(X, mu, sigma): | |
k = len(mu) | |
sigma=np.diag(sigma) | |
X = X - mu.T | |
p = 1/((2*np.pi)**(k/2)*(np.linalg.det(sigma)**0.5))* np.exp(-0.5* np.sum(X @ np.linalg.pinv(sigma) * X,axis=1)) | |
return p | |
p = multivariateGaussian(X, mu, sigma) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment