Euclidean distance and Euclidian Similarity - Integrated Circuits - - An Online Book - |
||||||||
| Integrated Circuits http://www.globalsino.com/ICs/ | ||||||||
| ================================================================================= | ||||||||
In word embeddings of word2vec model, Euclidian similarity cannot work well for the high-dimensional word vectors because Euclidian similarity will increase the number of dimensions increases even if the word embedding stands for different meanings. Alternatively, cosine similarity can be used to measure the similarity between two vectors. Mathematically, it measures the cosine of the angle between two vectors projected in a multi-dimensional space. Therefore, the cosine similarity captures the angle of the word vectors and not the magnitude. Under cosine similarity, no similarity is expressed as a 90-degree angle while the total similarity of 1 is at 0 degree angle. ================================================= Calculation of Euclidean distance: code: ================================================= Calculation of Euclidean distance: code: ====================================================== Find the best word similarity with Word2Vec Models/word embeddings: code:
|
||||||||
| ================================================================================= | ||||||||
|
|
||||||||