All LDA topic coefficients are 'nan'

941 views
Skip to first unread message

Lukas Toma

unread,
Dec 15, 2017, 1:38:49 AM12/15/17
to gensim
Hi,


With different data but exactly in the same format (or at least I cannot spot the difference)


top_topics = ldamodel.top_topics(corpus=corpus)

# Average topic coherence is the sum of topic coherences of all topics, divided by the number of topics.
avg_topic_coherence = sum([t[1] for t in top_topics]) / 5
print('Average topic coherence: %.4f.' % avg_topic_coherence)

from pprint import pprint
pprint(top_topics)

Average topic coherence: -10.6956.

[([(nan, u'imported'),
 
(nan, u'soon'),
 
(nan, u'privileged'),
 
(nan, u'authorized'),
 
(nan, u'specific'),
 
(nan, u'uploaded'),
 
(nan, u'twice'),
 
(nan, u'touch'),
 
(nan, u'teammate'),
 
(nan, u'video'),
 
(nan, u'product'),
 
(nan, u'agency'),
 
(nan, u'p'),
 
(nan, u'standard'),
 
(nan, u'responsibility'),

ANy ideas what I might be doing wrong?

Thanks

Ivan Menshikh

unread,
Dec 18, 2017, 12:55:03 AM12/18/17
to gensim
Hi Lukas,

this looks like a bug, can you create issue on github and add info about your gensim/numpy/scipy/python/os version?

Brijesh Singh

unread,
May 17, 2018, 1:46:35 PM5/17/18
to gensim
I am facing the same issue can you help me to solve, HDPModel and LSIModel is giving the proper result as in list of topic but LDAModel is giving with nan*
version-
gensim: 3.4.0
numpy: 1.14.3
scipy : 1.0.0
python : 3.6.4

Radim Řehůřek

unread,
May 18, 2018, 3:26:07 AM5/18/18
to gensim
Hi Brijesh,

can you try with an older version of gensim? Say 0.10.1.

I'd like to rule out any recent changes.

Thanks,
Radim

Nate TeBlunthuis

unread,
Jul 1, 2018, 3:21:23 AM7/1/18
to gensim
Greetings everyone,

I also appear to have this issue with LdaModel. I am using the same versions of gensim and numpy as the report, but python 3.6.3. For me the issue appears following a series of numpy runtime warnings on lines 446, 546, 103, 802. If I reduce the number of topics the problem goes away. I also tried gensim version 3.1 and did not have the problem (i think I noticed the problem after upgrading from 3.1. to 3.4). Hope that helps things narrow it down. 

My dataset is quite big so it would not be convenient to share. I can try to reproduce the issue on a smaller dataset if that would be helpful.

Greg Chase

unread,
Jul 30, 2018, 11:00:48 AM7/30/18
to gensim
I've also run into the same issue with the LDA model. It's been reproduced on Gensim 3.1.0 and 3.5, between 1 and 10 topics. 

Current software versions are below.
  • Python 3.6.4
  • Gensim 3.1.0
  • NumPy 1.14.5
  • SciPy 1.1.0

markin...@gmail.com

unread,
Aug 22, 2018, 2:03:32 PM8/22/18
to Gensim
I solve it by upgrading numpy to 1.15.0 version.

пятница, 15 декабря 2017 г., 8:38:49 UTC+2 пользователь Lukas Toma написал:
Reply all
Reply to author
Forward
0 new messages