[我想使用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)
您遇到由deprecation of clock
function of time
module引起的问题。已经是clock
。
要解决它,您有2个选项:
time
。