Generates skipgram word pairs.
skipgrams(sequence, vocabulary_size, window_size = 4, negative_samples = 1, shuffle = TRUE, categorical = FALSE, sampling_table = NULL, seed = NULL)
A word sequence (sentence), encoded as a list of word indices
(integers). If using a
Int, maximum possible word index + 1
Int, size of sampling windows (technically half-window).
The window of a word
float >= 0. 0 for no negative (i.e. random) samples. 1 for same number as positive samples.
whether to shuffle the word couples before returning them.
1D array of size
couples is a list of 2-element integer vectors:
labels is an integer vector of 0 and 1, where 1 indicates that
was found in the same window as
word_index, and 0 indicates that
categorical is set to
TRUE, the labels are categorical, ie. 1 becomes
and 0 becomes
This function transforms a list of word indexes (lists of integers) into lists of words of the form:
(word, word in the same window), with label 1 (positive samples).
(word, random word from the vocabulary), with label 0 (negative samples).
Read more about Skipgram in this gnomic paper by Mikolov et al.: Efficient Estimation of Word Representations in Vector Space