Skip to content

Instantly share code, notes, and snippets.

@RyotaBannai
Last active December 24, 2018 07:25
Show Gist options
  • Save RyotaBannai/1eddc120cae825ef5c232ac4b1aaede1 to your computer and use it in GitHub Desktop.
Save RyotaBannai/1eddc120cae825ef5c232ac4b1aaede1 to your computer and use it in GitHub Desktop.
C = np.cov(X.T) # Now shape is 2 *2
w, v = LA.eig(C)
inx = w.argsort()[::-1]
w, v = w[inx], v[:, inx]
w_12 = w[:2]
v_12 = v[:, :2]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment