Guest User

Untitled

a guest
Aug 22nd, 2019
68
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. model = Doc2Vec(min_count=1, window=10, size=200, seed=SEED, sample=1e-4,
  2. alpha=0.025, negative=5, workers=24)
  3. model.build_vocab([x for x in tqdm(train_documents)])
  4. train_documents = shuffle(train_documents)
  5. model.train(train_documents,total_examples=len(train_documents), epochs=30)
  6.  
  7. def vector_for_learning(model, input_docs):
  8. sents = input_docs
  9. targets, feature_vectors = zip(*[(doc.tags[0], model.infer_vector(doc.words, steps=20)) for doc in sents])
  10. return targets, feature_vectors
RAW Paste Data