Skip to content

Instantly share code, notes, and snippets.

@infinite-Joy
Created August 5, 2017 06:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save infinite-Joy/1f32307c3d9910b7b28fd429b1779b32 to your computer and use it in GitHub Desktop.
Save infinite-Joy/1f32307c3d9910b7b28fd429b1779b32 to your computer and use it in GitHub Desktop.
mean_vec = np.mean(X_std, axis=0)
cov_mat = (X_std - mean_vec).T.dot((X_std - mean_vec)) / (X_std.shape[0]-1)
print('Covariance matrix \n{}'.format(cov_mat))
print('Covariance matrix shape is: {}'.format(cov_mat.shape))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment