Skip to content

Commit 88fa936

Browse files
committedFeb 12, 2016
minor doc fixes
1 parent dbd99ed commit 88fa936

File tree

2 files changed

+14
-20
lines changed

2 files changed

+14
-20
lines changed
 

‎docs/src/support.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ Business support
2424

2525
I also run a consulting business for data mining and information retrieval solutions, `rare-technologies.com <http://rare-technologies.com>`_.
2626

27-
In case you need commercial support, design validation, technical training or custom system development, `get in touch <http://rare-technologies/contact>`_ for a quote.
27+
In case you need commercial support, design validation, technical training or custom system development, `get in touch <http://rare-technologies.com/contact>`_ for a quote.
2828

2929
Developer support
3030
------------------
3131

3232
Developers who `tweak gensim internals <https://github.com/piskvorky/gensim/wiki/Developer-page>`_ are encouraged to report issues at the `GitHub issue tracker <https://github.com/piskvorky/gensim/issues>`_.
3333
Note that this is not a medium for discussions or asking open-ended questions; please use the mailing list for that.
34-

‎gensim/models/ldamodel.py

+13-18
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def dirichlet_expectation(alpha):
6767
result = psi(alpha) - psi(numpy.sum(alpha, 1))[:, numpy.newaxis]
6868
return result.astype(alpha.dtype) # keep the same precision as input
6969

70+
7071
def update_dir_prior(prior, N, logphat, rho):
7172
"""
7273
Updates a given prior using Newton's method, described in
@@ -363,7 +364,7 @@ def init_dir_prior(self, prior, name):
363364
# eta is a column: [[0.1],
364365
# [0.1]]
365366
if init_prior.shape == (self.num_topics,) or init_prior.shape == (1, self.num_topics):
366-
init_prior = init_prior.reshape((self.num_topics, 1)) # this statement throws ValueError if eta did not match self.num_topics
367+
init_prior = init_prior.reshape((self.num_topics, 1)) # this statement throws ValueError if eta did not match self.num_topics
367368

368369
return init_prior, is_auto
369370

@@ -482,7 +483,6 @@ def do_estep(self, chunk, state=None):
482483
state.numdocs += gamma.shape[0] # avoids calling len(chunk) on a generator
483484
return gamma
484485

485-
486486
def update_alpha(self, gammat, rho):
487487
"""
488488
Update parameters for the Dirichlet prior on the per-document
@@ -504,7 +504,7 @@ def update_eta(self, lambdat, rho):
504504
if self.eta.shape[1] != 1:
505505
raise ValueError("Can't use update_eta with eta matrices, only column vectors.")
506506
N = float(lambdat.shape[1])
507-
logphat = (sum(dirichlet_expectation(lambda_) for lambda_ in lambdat.transpose()) / N).reshape((self.num_topics,1))
507+
logphat = (sum(dirichlet_expectation(lambda_) for lambda_ in lambdat.transpose()) / N).reshape((self.num_topics, 1))
508508

509509
self.eta = update_dir_prior(self.eta, N, logphat, rho)
510510
logger.info("optimized eta %s", list(self.eta.reshape((self.num_topics))))
@@ -548,22 +548,17 @@ def update(self, corpus, chunksize=None, decay=None, offset=None,
548548
`corpus` sizes, an increasing `offset` may be beneficial (see
549549
Table 1 in Hoffman et al.)
550550
551-
Parameters
552-
------------
553-
corpus: (gensim corpus object, list of tuples)
554-
The corpus with which the LDA model should be updated with.
551+
Args:
552+
corpus (gensim corpus): The corpus with which the LDA model should be updated.
555553
556-
chunks_as_numpy: bool
557-
Whether each chunk passed to `.inference` should be a numpy
558-
array of not. Numpy can in some settings turn the term IDs
559-
into floats, these will be converted back into integers in
560-
inference, which incurs a performance hit. For distributed
561-
computing it may be desirable to keep the chunks as numpy
562-
arrays.
554+
chunks_as_numpy (bool): Whether each chunk passed to `.inference` should be a numpy
555+
array of not. Numpy can in some settings turn the term IDs
556+
into floats, these will be converted back into integers in
557+
inference, which incurs a performance hit. For distributed
558+
computing it may be desirable to keep the chunks as numpy
559+
arrays.
563560
564-
See Also
565-
--------
566-
For other parameter settings see LdaModel().
561+
For other parameter settings, see :class:`LdaModel` constructor.
567562
568563
"""
569564
# use parameters given in constructor, unless user explicitly overrode them
@@ -930,7 +925,7 @@ def save(self, fname, ignore=['state', 'dispatcher'], *args, **kwargs):
930925
931926
`ignore` parameter can be used to define which variables should be ignored, i.e. left
932927
out from the pickled lda model. By default the internal `state` is ignored as it uses
933-
its own serialisation not the one provided by `LdaModel`. The `state` and `dispatcher
928+
its own serialisation not the one provided by `LdaModel`. The `state` and `dispatcher`
934929
will be added to any ignore parameter defined.
935930
936931

0 commit comments

Comments
 (0)
Please sign in to comment.