I want to get a vector of words every few iter in word2vec
, e.g., I would like to use the model below.
embedding_model = Word2Vec(test_set, size=300,
window=4, workers=6,
iter=300, sg=1, min_count=10)
In this model, I want to get the 300-dimensional vectors learned for every 50 iterations, because I want to show continuous learning contents in html d3.
How can I do this?
You can call train()
method iteratively 6 times, each with epochs=50
:
model = gensim.models.word2vec.Word2Vec(size=300, window=4, workers=6, sg=1,
min_count=10)
model.build_vocab(sentences)
for i in range(6):
model.train(sentences, total_examples=model.corpus_count, epochs=50)
print(model.wv.word_vec('the')) # get the intermediate vector(s)