Skip to content

Instantly share code, notes, and snippets.

@normalhuman
Created December 4, 2015 02:27
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 normalhuman/bcd241e58fbf1f83f047 to your computer and use it in GitHub Desktop.
Save normalhuman/bcd241e58fbf1f83f047 to your computer and use it in GitHub Desktop.
An example of using truncated SVD for latent semantic indexing
A = [0 1 1 0 1 1; 2 1 1 0 3 0; 0 0 0 4 0 2; 3 2 1 0 1 0; 0 0 1 1 0 3]
[U,D,V] = svd(A)
D2 = D.*(D>=5)
A2 = U*D2*V'
for j=1:6 disp(A2(1,j)/norm(A2(:,j))); end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment