Wednesday 7 August 2013

Latent Semantic Indexing Matlab Code

In below we give the code of lsi on matlab.



function sim = lsi_calc(A,q,k)

[m,n] = size(A);

[U,S,V] = svds(A,k);

qc = q'*U*inv(S);

for i = 1:n % Loop over all documents

    sim(i) = (qc * V(i,:)') / (norm(qc) * norm(V(i,:)));

end;


Kindly Bookmark and Share it:

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...