Word2Vec

Word2Vec - Modes

Word2Vec can utilize either of two model architectures:

  • continuous bag-of-words (CBoW) - the model predicts the current word from a window of surrounding context words
  • continuous skip-gram - the model uses the current word to predict the surrounding window of context words

Word2Vec - Architectures

Word2Vec - Code

from gensim.models import KeyedVectors
 
model = KeyedVectors.load_word2vec_format('data/GoogleNews-vectors-negative300.bin', binary=True)
similar_words = model.most_similar('robots')
print(similar_words)