Skip to content

Instantly share code, notes, and snippets.

@RyotaBannai
Last active December 27, 2018 15:11
Show Gist options
  • Save RyotaBannai/5cbbbb55c182d9ba176352d449a75cab to your computer and use it in GitHub Desktop.
Save RyotaBannai/5cbbbb55c182d9ba176352d449a75cab to your computer and use it in GitHub Desktop.
T = X.dot(v) # Projecting sample data
T = T[:, 0:2]
# Or simply, T = X.dot(v_12)
T_mean = T.mean(axis=0)
C_T = np.cov(T.T) # Shape 2 *2
wT, vT = LA.eig(C_T)
inxT = wT.argsort()[::-1]
wT, v = wT[inxT], vT[:, inxT]
w_12_T = wT[:2]
v_12_T = vT[:,:2]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment