dselivanov / text2vec

Fast vectorization, topic modeling, distances and GloVe word embeddings in R.
http://text2vec.org
Other
852 stars 136 forks source link

Non-conformable arguments error when invoking lsa$get_word_vectors() #174

Closed Silverneo closed 7 years ago

Silverneo commented 7 years ago

I was trying to fit my text data into LSA model and it works. However, when I tried get_word_vectors() method, I received the following error:

Error in diag(x = private$singular_values) %*% private$lsa_factor_matrix : non-conformable arguments

The function definition in model_LSA.R is as follows and I suspect the matrices multiplied do not match each other in dimensions.

    get_word_vectors = function() {
      diag(x = private$singular_values) %*% private$lsa_factor_matrix
    }

I did a test as follows:

svd_fit_d <- lsa$.__enclos_env__$private$singular_values
length(svd_fit_d) # 25
svd_fit_v <- lsa$.__enclos_env__$private$lsa_factor_matrix
dim(svd_fit_v)     # 3458 25

Can you help with this issue? Many thanks!

Chunmeng

dselivanov commented 7 years ago

Thanks for reporting, this is a bug, will fix today.

dselivanov commented 7 years ago

@Silverneo should be fixed now, check latest version from github.

Silverneo commented 7 years ago

@dselivanov Thanks!