Posts

Showing posts with the label word2vec

gensim function predict output words

gensim function predict output words I use the gensim library to create a word2vec model. It contains the function predict_output_words() which I understand as follows: predict_output_words() For example, I have a model that is trained with the sentence: "Anarchism does not offer a fixed body of doctrine from a single particular world view instead fluxing and flowing as a philosophy." and then I use model.predict_output_words(context_words_list=['Anarchism', 'does', 'not', 'offer', 'a', 'fixed', 'body', 'of', 'from', 'a', 'single', 'particular', 'world', 'view', 'instead', 'fluxing'], topn=10) . model.predict_output_words(context_words_list=['Anarchism', 'does', 'not', 'offer', 'a', 'fixed', 'body', 'of', 'from', 'a', 'single', 'particular', 'world...

word2vec gensim update learning rate

word2vec gensim update learning rate I trained a w2v model on a big corpus, and I want to update it with a smaller one with new sentences (and new words). In the first big training, I took the default parameters for alpha (0.025 with lin. decay to 0.0001) Now, I want to use model.train to update it. But from the doc I don't understand which (initial and final) learning rate will be used during this update of training. model.train From one side, if you also use 0.025 with lin. decay until 0.0001, it will be too strong for already existing words which appeared a lot in the first big corpus and that will be heavily changed, but from the other side for new words (added with model.build_vocab(sentences, update = True)) a low learning rate of 0.0001 is too small. So my questions are : model.train How I should choose the learning rate in order to take into account this issue of old/new words ? [aside question] Why when I use 2 times model.train on the same sentences, the second time, it...

Words from word2vec not present in TensorBoard

Image
Words from word2vec not present in TensorBoard I'm working on a project which is needed to use word2vec. when I run my simple code everything gonna be ok but while I use tensorboard to see my result, I just face a 3D vector with JUST THE FIRST LITTER OF SOME WORDS! **my corpus is in english and have 1000 sentences **at first I didn't token my corpus but now I do Why should I do??? and here is my code: import logging import gensim from gensim.models.word2vec import Word2Vec vector_size = 512 window_size = 10 logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO) word2vec = Word2Vec (sentences='dataset.csv',size=200 ,window=10,negative=20,seed=1000,min_count=1) word2vec.save('text646.model') word2vec.wv.save_word2vec_format('text.model.bin', binary=True) model= gensim.models.KeyedVectors.load_word2vec_format('text.model.bin', binary=True) Here is a screen shot from tensorbord: thank alot ...