You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think there is an error in the way the LSA is computed in textmodel_lsa.R. After the svd decomposition, the v singular vectors are usually weighed with the k remaining singular values. However, at line 80 the matrix v is multiplied column-wise with d instead of row-wise. See :
The text was updated successfully, but these errors were encountered:
JFChartier
changed the title
textmodel_lsa does not weigth correctly the 'v singular vectors' with the singular values?
textmodel_lsa does not weigth correctly the v singular vectors with the singular values?
Aug 15, 2023
The column-wise weighing is correct when margin=feature because dec$u is a k*n matrix (where n is the number of documents). However when margin=documents, dec$v is a m*k matrix (where m is the number of features/words) so a column-wise multiplication does not make sense.
Hello,
I think there is an error in the way the LSA is computed in
textmodel_lsa.R
. After the svd decomposition, thev
singular vectors are usually weighed with thek
remaining singular values. However, at line 80 the matrixv
is multiplied column-wise withd
instead of row-wise. See :quanteda.textmodels/R/textmodel_lsa.R
Line 80 in 75d495e
If I'm not wrong, the correct way to weight the
v
singular vectors should bev
%*%diag(d)
?This is how the weighing is calculated in the
text2vec
package. See:https://github.com/dselivanov/text2vec/blob/e3b9865057ba8dae713badbf71ca5160b7a6efa6/R/model_LSA.R#L76
Thanks!
The text was updated successfully, but these errors were encountered: