我正在开发一个主题建模脚本,该脚本使用 gensim 包创建基于文档集合的模型。
当准备使用 pyLDAvis 包可视化模型时,我遇到了这个错误:
import pyLDAvis
pyLDAvis.enable_notebook()
Traceback (most recent call last):
File "/dev2.py", line 2, in <module>
pyLDAvis.enable_notebook()
File "/Users/username/Library/Python/3.6/lib/python/site-packages/pyLDAvis/_display.py", line 311, in enable_notebook
formatter = ip.display_formatter.formatters['text/html']
AttributeError: 'NoneType' object has no attribute 'display_formatter'
请您参考如下方法:
enable_notebook 功能仅在您使用笔记本时使用。如果您正在编写将可视化输出为 HTML 文档的脚本,那么您不需要(也不应该)调用该函数。相反,我认为您需要使用的只是 prepare 和 save_html功能。
