In word2vec, it's common to map a word in dictionary to a coordinate in an N-dimension space. Is there any way to reverse this process and synthesize a word given any position in the space?
Asked
Active
Viewed 345 times
0
-
This is called "finding nearest neighbor" at the query point. – greeness Jun 26 '16 at 08:30
2 Answers
1
When going from coordinates to word it's not necessary that there would be a vector embedding at the coordinates you are looking at. One way can be to search for the closest vector and return the corresponding word. Say you have "cat" represented by [1,2,4], "dog" by [2,1,6] and so on.
index2word = ["cat","dog","crow","owl"]
vecArray=[[1,2,4],
[2,1,6],
[9,1,5],
[4,6,2]]
query=[2,1,7] #the vector whose word is required
distance=dot(vecArray,query)
Find index of minimum element of distance array. Use it to get word from index2word array.

Arshiyan Alam
- 335
- 1
- 11
0
You could code your n-dimension-coordinate as string and compare them with your coordinate string.

Queue
- 163
- 5