find_projection {text2map}R Documentation

Find the 'projection matrix' to a semantic vector

Description

"Project" each word in a word embedding matrix of DD dimension along a vector of DD 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().

Usage

find_projection(wv, vec)

Arguments

wv

Matrix of word embedding vectors (a.k.a embedding model) with rows as words.

vec

Vector extracted from the embeddings

Details

All the vectors in the matrix AA are projected onto the a vector, vv, to find the projection matrix, PP, defined as:

P=AvvvvP = \frac{A \cdot v}{v \cdot v} * v

Value

A new word embedding matrix, each row of which is parallel to vector.


[Package text2map version 0.2.0 Index]