Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hadrienj/aed685310da6a8b3ea154584b3653236 to your computer and use it in GitHub Desktop.
Save hadrienj/aed685310da6a8b3ea154584b3653236 to your computer and use it in GitHub Desktop.
def calculateCovariance(X):
meanX = np.mean(X, axis = 0)
lenX = X.shape[0]
X = X - meanX
covariance = X.T.dot(X)/lenX
return covariance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment