基于LDA的评论大数据的分析及主题建模

本文讲述了在使用Python的pyLDAvis库对微博关键词大数据进行LDA主题分析时遇到的四个常见问题,包括模块导入错误、属性访问错误、排序问题和网络请求错误。作者提供了相应的解决方法,并提到流程已经跑出但需要进一步优化,如数据清洗、参数调整等。
摘要由CSDN通过智能技术生成

1.微博的关键词大数据采集;

已完成,待优化

2.LDA

错误1:使用了import pyLDAvis.sklearn,提示没有模块no module named 'pyldavis.sklearn'

默认安装 pyLDAvis==3.4.1,最后降级处理,解决方式:

 pip install pyLDAvis==3.2.2

错误2: return vectorizer.get_feature_names()
AttributeError: 'CountVectorizer' object has no attribute 'get_feature_names'

解决方式:修改为:return vectorizer.get_feature_names_out()

错误3:

pyLDAvis\_prepare.py", line 247, in _topic_info
    default_term_info = default_term_info.sort_values(
TypeError: drop() takes from 1 to 2 positional arguments but 3 were given

解决方式:

修改_prepare.py文件 ,
将248行代码改为drop(‘saliency’, 1) ==> drop(‘saliency’, axis=1)

错误4:OSError: [Errno 22] Invalid argument: 'https://cdn.jsdelivr.net/gh/bmabey/py

修改报错处,即_display.py的227.py,local=True改为local=False


参考链接:LDA代码训练报错记录_typeerror: drop() takes from 1 to 2 positional arg-CSDN博客

pyLDAvis生成LDA主题并可视化_py ldavis 库-CSDN博客

pyLDAvis实现LDA结果可视化时报错OSError:invalid argument_python pyldavis.show() 报错-CSDN博客

已解决AttributeError: ‘CountVectorizer‘ object has no attribute ‘get_feature_names‘_countvectorizer' object has no attribute 'get_feat-CSDN博客

整出LDA图,流程跑出来了,待优化。(数据清洗,调参,其他方法,需要优化)

  • 10
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值