Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- model = Doc2Vec(min_count=1, window=10, size=200, seed=SEED, sample=1e-4,
- alpha=0.025, negative=5, workers=24)
- model.build_vocab([x for x in tqdm(train_documents)])
- train_documents = shuffle(train_documents)
- model.train(train_documents,total_examples=len(train_documents), epochs=30)
- def vector_for_learning(model, input_docs):
- sents = input_docs
- targets, feature_vectors = zip(*[(doc.tags[0], model.infer_vector(doc.words, steps=20)) for doc in sents])
- return targets, feature_vectors
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement