Skip to content

Instantly share code, notes, and snippets.

@BernardOng
Created August 22, 2016 00:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BernardOng/5c004ba303dedcfb8afbc49f8b5f8b35 to your computer and use it in GitHub Desktop.
Save BernardOng/5c004ba303dedcfb8afbc49f8b5f8b35 to your computer and use it in GitHub Desktop.
# [Doc2Vec Parameters]
vec_dim = 30
win_size = 1
alpha = 0.01
np.random.seed(381888)
min_count = 2
sample = 1e-5
workers = 100
epochs = 10
# build
model = Doc2Vec(size=int(vec_dim), window=win_size, alpha=alpha, min_count=min_count, sample=sample, workers=workers)
model.build_vocab(tList.toArray())
tmpList = tList.toArray()
print 'Training Model...'
for e in range(epochs):
print '\tEpoch ' + str(e)
random.shuffle(tmpList)
model.alpha -= 0.001
model.min_alpha = model.alpha
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment