我想使用来自gensim的HDP模型来获得我的语料库的主题数,我已经用这个语料库和字典从gensim训练了一个规则的LDA模型,它工作得很好。但现在当我这么做
hdp = models.HdpModel(bow_corpus, dictionary)我得到了
Traceback (most recent call last):
File "models.py", line 185, in <module>
hdp = models.HdpModel(bow_corpus, dictionary)
File "/usr/lib/python3.8/site-packages/gensim/models/hdpmodel.py", line 391, in __init__
self.update(corpus)
File "/usr/lib/python3.8/site-packages/gensim/models/hdpmodel.py", line 467, in update
start_time = time.clock()
AttributeError: module 'time' has no attribute 'clock'这是个虫子吗?
$ python --version
Python 3.8.2 (default, Feb 26 2020, 22:21:03) 编辑以添加更多系统信息
>>> print(gensim.__version__)
3.8.1
uname -a
Linux ** 5.5.9-arch1-2 #1 SMP PREEMPT Thu, 12 Mar 2020 23:01:33 +0000 x86_64 GNU/Linux发布于 2020-04-20 15:49:39
您会遇到由deprecation of clock function of time module引起的问题。它是deprecated since Python v. 3.3 and removed in v. 3.8。
要解决这个问题,您有两个选项:
如果您没有最新版本,
gensim。的级别。
https://stackoverflow.com/questions/61310229
复制相似问题