View source: R/utils-embedding-matrices.R
| find_projection | R Documentation |
"Project" each word in a word embedding matrix of D dimension along a
vector of D dimensions, extracted from the same embedding space.
The vector can be a single word, or a concept vector obtained from
get_centroid(), get_direction(), or get_regions().
find_projection(wv, vec)
wv |
Matrix of word embedding vectors (a.k.a embedding model) with rows as words. |
vec |
Vector extracted from the embeddings |
All the vectors in the matrix A are projected onto the a vector,
v, to find the projection matrix, P, defined as:
P = \frac{A \cdot v}{v \cdot v} * v
A new word embedding matrix, each row of which is parallel to vector.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.