Skip to content

Instantly share code, notes, and snippets.

@abhishek-Kumar009
Created February 10, 2019 15:27
Show Gist options
  • Save abhishek-Kumar009/f9b234eceaf70a5da3061ad221ba971c to your computer and use it in GitHub Desktop.
Save abhishek-Kumar009/f9b234eceaf70a5da3061ad221ba971c to your computer and use it in GitHub Desktop.
def estimateGaussian(X):
n = np.size(X, 1)
m = np.size(X, 0)
mu = np.zeros((n, 1))
sigma2 = np.zeros((n, 1))
mu = np.reshape((1/m)*np.sum(X, 0), (1, n))
sigma2 = np.reshape((1/m)*np.sum(np.power((X - mu),2), 0),(1, n))
return mu, sigma2
mu, sigma2 = estimateGaussian(X)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment