这是gensim hdp模型python 3.8的错误吗?

问题描述 投票:0回答:1

[我想使用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) 
python-3.x time gensim python-3.8
1个回答
0
投票

您遇到由deprecation of clock function of time module引起的问题。已经是clock

要解决它,您有2个选项:

  1. 如果没有最新版本,请尝试升级time
  2. 尝试降级Python。
© www.soinside.com 2019 - 2024. All rights reserved.