我想在Bybee、Leland 和 Kelly、Bryan T. 和 Manela、Asaf 和 Xiu、Da Cheng、《商业新闻和商业周期》(即将发表在《金融杂志》上)中应用“贝叶斯因子”方法。因此,我想计算具有选定主题编号的LDA模型的后验概率,以便我可以比较具有不同主题编号的不同模型。 我尝试在gensim中使用“LdaState”,但是,我未能获得正确的参数。 谁能告诉我如何使用“LdaState”?
例如:
eta = lda0.eta
lamda = LdaState(eta, shape=((i, 10),)).get_lambda()
File "C:\Users\AppData\Roaming\JetBrains\PyCharmCE2023.2\scratches\scratch_10.py", line 71, in run
lamda = LdaState(eta, shape=((i, 10),)).get_lambda()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\User\PycharmProjects\pythonProject\venv\Lib\site-packages\gensim\models\ldamodel.py", line 174, in __init__
self.sstats = np.zeros(shape, dtype=dtype)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'tuple' object cannot be interpreted as an integer