dimensionality reduc1on lecture 23
play

Dimensionality Reduc1on Lecture 23 David Sontag New York - PowerPoint PPT Presentation

Dimensionality Reduc1on Lecture 23 David Sontag New York University Slides adapted from Carlos Guestrin and Luke Zettlemoyer Assignments Last homework assignment released tonight,


  1. Dimensionality ¡Reduc1on ¡ Lecture ¡23 ¡ David ¡Sontag ¡ New ¡York ¡University ¡ Slides adapted from Carlos Guestrin and Luke Zettlemoyer

  2. Assignments ¡ • Last ¡homework ¡assignment ¡released ¡tonight, ¡ due ¡next ¡Thursday ¡(Dec. ¡5) ¡ • Final ¡project ¡write-­‑up ¡due ¡December ¡15 ¡ • 10 ¡minute ¡presentaJons ¡(1 ¡per ¡group) ¡ – Part ¡of ¡your ¡grade ¡ – During ¡final ¡exam ¡period, ¡Dec. ¡17, ¡10-­‑11:50am ¡ • I ¡need ¡4 ¡groups ¡to ¡volunteer ¡to ¡give ¡their ¡ presentaJon ¡on ¡Dec. ¡12 ¡ 2

  3. Dimensionality ¡reducJon ¡ • Input ¡data ¡may ¡have ¡thousands ¡or ¡millions ¡of ¡ dimensions! ¡ – e.g., ¡text ¡data ¡has ¡???, ¡images ¡have ¡??? ¡ ¡ • Dimensionality ¡reduc1on : ¡represent ¡data ¡with ¡ fewer ¡dimensions ¡ – easier ¡learning ¡– ¡fewer ¡parameters ¡ – visualizaJon ¡– ¡show ¡high ¡dimensional ¡data ¡in ¡2D ¡ – discover ¡“intrinsic ¡dimensionality” ¡of ¡data ¡ • high ¡dimensional ¡data ¡that ¡is ¡truly ¡lower ¡dimensional ¡ ¡ • noise ¡reducJon ¡

  4. !"#$%&"'%()$*+,-"'% � .&&+#/-"'%0(*1-1(21//)'3"#1-$456(4"$&('%( 1(4'7$)(*"#$%&"'%14(&/1,$ � 831#/4$&0 Slide from Yi Zhang

  5. Lower ¡dimensional ¡projecJons ¡ • Rather ¡than ¡picking ¡a ¡subset ¡of ¡the ¡features, ¡we ¡can ¡ obtain ¡new ¡ones ¡by ¡combining ¡exisJng ¡features ¡x 1 ¡… ¡x n ¡ z 1 = w (1) w (1) ⌥ + x i ⌥ 0 i … i z k = w ( k ) w ( k ) ⌥ + x i 0 i i • New ¡features ¡are ¡linear ¡combinaJons ¡of ¡old ¡ones ¡ • Reduces ¡dimension ¡when ¡k<n ¡ • Let’s ¡consider ¡how ¡to ¡do ¡this ¡in ¡the ¡unsupervised ¡ se]ng ¡ ¡ – just ¡ X , ¡but ¡no ¡Y ¡

  6. Which ¡projecJon ¡is ¡be_er? ¡ From notes by Andrew Ng

  7. Reminder: ¡Vector ¡ProjecJons ¡ • Basic ¡definiJons: ¡ – A.B ¡= ¡|A||B|cos ¡θ ¡ – cos ¡θ ¡= ¡|adj|/|hyp| ¡ ¡ • Assume ¡|B|=1 ¡(unit ¡vector) ¡ – A.B ¡= ¡|A|cos ¡θ ¡ – So, ¡dot ¡product ¡is ¡length ¡of ¡ projecJon!!! ¡

  8. Using ¡a ¡new ¡basis ¡for ¡the ¡data ¡ • Project ¡a ¡point ¡into ¡a ¡(lower ¡dimensional) ¡space: ¡ – point : ¡ x ¡ = ¡(x 1 ,…,x n ) ¡ ¡ – select ¡a ¡basis ¡– ¡set ¡of ¡unit ¡(length ¡1) ¡basis ¡vectors ¡ ( u 1 ,…, u k ) ¡ • we ¡consider ¡orthonormal ¡basis: ¡ ¡ – u i • u i =1, ¡and ¡ u i • u j =0 ¡for ¡i ≠ j ¡ – select ¡a ¡center ¡– ¡ x , ¡defines ¡offset ¡of ¡space ¡ ¡ – best ¡coordinates ¡ in ¡lower ¡dimensional ¡space ¡ defined ¡by ¡dot-­‑products: ¡(z 1 ,…,z k ), ¡z j ¡= ¡( x -­‑ x ) • u j ¡

  9. Maximize ¡variance ¡of ¡projecJon ¡ Let x (i) be the i th data point minus the mean. Choose unit-length u to maximize: m m 1 1 ( x ( i ) T u ) 2 u T x ( i ) x ( i ) T u � � = m m i =1 i =1 � � m 1 x ( i ) x ( i ) T � u T = u. m i =1 Let ||u||=1 and maximize. Using the method of Lagrange multipliers, can show that the solution is given by the principal eigenvector of the covariance matrix! (shown on board)

  10. Basic ¡PCA ¡algorithm ¡ • Start ¡from ¡m ¡by ¡n ¡data ¡matrix ¡ X ¡ • Recenter : ¡subtract ¡mean ¡from ¡each ¡row ¡of ¡ X ¡ – X c ¡ ← ¡X ¡– ¡X ¡ • Compute ¡covariance ¡ matrix: ¡ – ¡ Σ ¡ ← ¡ 1/m ¡X c T ¡X c ¡ • Find ¡ eigen ¡vectors ¡and ¡values ¡ of ¡ Σ ¡ ¡ • Principal ¡components: ¡k ¡eigen ¡vectors ¡with ¡ highest ¡eigen ¡values ¡

  11. PCA ¡example ¡ Data: Projection: Reconstruction:

  12. Dimensionality ¡reducJon ¡with ¡PCA ¡ In high-dimensional problem, data usually lies near a linear subspace, as noise introduces small variability Only keep data projections onto principal components with large eigenvalues Can ignore the components of lesser significance. 25 20 Variance (%) 15 10 5 0 PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8 PC9 PC10 You might lose some information, but if the eigenvalues �������������������������� much 23 Slide from Aarti Singh

  13. Eigenfaces ¡ [Turk, ¡Pentland ¡’91] ¡ • Input ¡images: ¡  Principal components:

  14. Eigenfaces ¡reconstrucJon ¡ • Each ¡image ¡corresponds ¡to ¡adding ¡together ¡ (weighted ¡versions ¡of) ¡the ¡principal ¡ components: ¡

  15. Scaling ¡up ¡ • Covariance ¡matrix ¡can ¡be ¡really ¡big! ¡ – ¡ Σ ¡is ¡n ¡by ¡n ¡ – 10000 ¡features ¡can ¡be ¡common! ¡ ¡ – finding ¡eigenvectors ¡is ¡very ¡slow… ¡ • Use ¡singular ¡value ¡decomposiJon ¡(SVD) ¡ – Finds ¡k ¡eigenvectors ¡ – great ¡implementaJons ¡available, ¡e.g., ¡Matlab ¡svd ¡

  16. SVD ¡ • Write ¡ X ¡= ¡W ¡S ¡V T ¡ – X ¡ ← ¡data ¡matrix, ¡one ¡row ¡per ¡datapoint ¡ – W ¡ ← ¡weight ¡matrix, ¡one ¡row ¡per ¡datapoint ¡– ¡ coordinate ¡of ¡ x i ¡in ¡eigenspace ¡ ¡ – S ¡ ← ¡singular ¡value ¡matrix, ¡diagonal ¡matrix ¡ • in ¡our ¡se]ng ¡each ¡entry ¡is ¡eigenvalue ¡ λ j ¡ – V T ¡ ← ¡singular ¡vector ¡matrix ¡ • in ¡our ¡se]ng ¡each ¡row ¡is ¡eigenvector ¡ v j ¡

  17. PCA ¡using ¡SVD ¡algorithm ¡ • Start ¡from ¡m ¡by ¡n ¡data ¡matrix ¡ X ¡ • Recenter : ¡subtract ¡mean ¡from ¡each ¡row ¡of ¡ X ¡ – X c ¡ ← ¡X ¡– ¡X ¡ • Call ¡SVD ¡ algorithm ¡on ¡ X c ¡– ¡ask ¡for ¡k ¡singular ¡ vectors ¡ • Principal ¡components: ¡k ¡singular ¡vectors ¡with ¡ highest ¡singular ¡values ¡(rows ¡of ¡ V T ) ¡ – Coefficients: ¡ project ¡each ¡point ¡onto ¡the ¡new ¡vectors ¡

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend