On Mon, Feb 4, 2013 at 7:21 PM, Oscar Benjamin <oscar.j.benja...@gmail.com> wrote: > eigenvalues, eigenvectors = np.linalg.eig(C)
First sort by eigenvalue magnitude: >>> idx = np.argsort(eigenvalues)[::-1] >>> print idx [ 0 1 2 3 8 10 11 12 14 22 20 21 18 19 23 24 17 16 15 13 9 7 5 6 4] >>> eigenvalues = eigenvalues[idx] >>> eigenvectors = eigenvectors[:, idx] > # 2D PCA - get the two eigenvectors with the largest eigenvalues > v1, v2 = eigenvectors[:,:2].T _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor