Skip to content

Commit

Permalink
Replace num_topics with self.num_topics (#689)
Browse files Browse the repository at this point in the history
  • Loading branch information
himkt authored and tmylk committed May 4, 2016
1 parent b99e852 commit 4810577
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions gensim/models/ldamodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,13 @@ def __init__(self, corpus=None, num_topics=100, id2word=None,

self.alpha, self.optimize_alpha = self.init_dir_prior(alpha, 'alpha')

assert self.alpha.shape == (num_topics,), "Invalid alpha shape. Got shape %s, but expected (%d, )" % (str(self.alpha.shape), num_topics)
assert self.alpha.shape == (self.num_topics,), "Invalid alpha shape. Got shape %s, but expected (%d, )" % (str(self.alpha.shape), self.num_topics)

self.eta, self.optimize_eta = self.init_dir_prior(eta, 'eta')

assert (self.eta.shape == (num_topics, 1) or self.eta.shape == (num_topics, self.num_terms)), (
assert (self.eta.shape == (self.num_topics, 1) or self.eta.shape == (self.num_topics, self.num_terms)), (
"Invalid eta shape. Got shape %s, but expected (%d, 1) or (%d, %d)" %
(str(self.eta.shape), num_topics, num_topics, self.num_terms))
(str(self.eta.shape), self.num_topics, self.num_topics, self.num_terms))

# VB constants
self.iterations = iterations
Expand All @@ -310,7 +310,7 @@ def __init__(self, corpus=None, num_topics=100, id2word=None,
import Pyro4
dispatcher = Pyro4.Proxy('PYRONAME:gensim.lda_dispatcher')
logger.debug("looking for dispatcher at %s" % str(dispatcher._pyroUri))
dispatcher.initialize(id2word=self.id2word, num_topics=num_topics,
dispatcher.initialize(id2word=self.id2word, num_topics=self.num_topics,
chunksize=chunksize, alpha=alpha, eta=eta, distributed=False)
self.dispatcher = dispatcher
self.numworkers = len(dispatcher.getworkers())
Expand Down

0 comments on commit 4810577

Please sign in to comment.