From 48105777b4c162c7e9d3f4051e6232c384177cd0 Mon Sep 17 00:00:00 2001 From: himkt Date: Wed, 4 May 2016 21:27:04 +0900 Subject: [PATCH] Replace num_topics with self.num_topics (#689) --- gensim/models/ldamodel.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gensim/models/ldamodel.py b/gensim/models/ldamodel.py index e2ea6010db..79edeb52e9 100755 --- a/gensim/models/ldamodel.py +++ b/gensim/models/ldamodel.py @@ -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 @@ -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())