{ }
View source on GitHub |
Generates skipgram word pairs.
tf.keras.preprocessing.sequence.skipgrams(
sequence,
vocabulary_size,
window_size=4,
negative_samples=1.0,
shuffle=True,
categorical=False,
sampling_table=None,
seed=None
)
Used in the notebooks
Used in the tutorials |
---|
DEPRECATED.
This function transforms a sequence of word indexes (list of integers) into tuples 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
Returns | |
---|---|
couples, labels: where couples are int pairs and
labels are either 0 or 1.
|
Note | |
---|---|
By convention, index 0 in the vocabulary is a non-word and will be skipped. |