normalize: Normalize all word vectors to the unit length 1.
Description
L2-normalization (scaling to unit euclidean length):
the norm of each vector in the vector space will be normalized to 1.
It is necessary for any linear operation of word vectors.
R code:
Vector: vec / sqrt(sum(vec^2))
Matrix: mat / sqrt(rowSums(mat^2))
Usage
normalize(x)
Value
A wordvec (data.table) or embed (matrix) with normalized word vectors.
Arguments
x
A wordvec (data.table) or
embed (matrix),
see data_wordvec_load.