2
$\begingroup$

I'd like to ask, if there is possibility to get sentence (or word) from embedding vector using Universal Sentence Encoder?

First of all, I've clustered my embedded sentences and I've got a vector which is representing center of the cluster, and now I want to convert this to some sentence which will have the best meaning for this specific cluster.

Best regards.

$\endgroup$
1
$\begingroup$

You cannot run the universal sentence encoder in reverse. There is no practical way to take an arbitrary embedding vector and get a sentence.

My suggestion would instead be to find the sentence in your data with the embedding closest to your center. Euclidean distance works well, specially if you used K-means or another euclidean method to create your clusters.

| improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ This answer is fine, but searching is not the only way. You could add that in principle, another component could be trained to generate sentences given a sentence embedding. This is basically what happens in machine translation systems, and also some sentence embedding systems are trained in this way (there is a decoder component that generates sentences that is used only for training). $\endgroup$ – Mathias Müller Feb 13 at 17:39
  • 1
    $\begingroup$ You are right, training a decoder from scratch to reverse the USE would be a possible method. Still not feasible, but definitely worth mentioning. I mostly wanted to suggest the practical advice in my second paragraph and did not think it through enough. Thank you for adding. $\endgroup$ – Simon Larsson Feb 13 at 22:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.