gpt4 book ai didi

python - yellowbrick visualiser.fit() 引发 ValueError

转载 作者:太空宇宙 更新时间:2023-11-04 00:03:06 25 4
gpt4 key购买 nike

我正在尝试为我的 Twitter 数据可视化离散图

这是数据集的链接

dataset

这是代码

from yellowbrick.text import DispersionPlot

text = combine['tweet']
target_words = ht_negative_unnest

visualizer = DispersionPlot(target_words)
visualizer.fit(text)
visualizer.poof()

我试图在存储在 ht_negative_unnest 中的上述代码中传递这样的列表

 ['cnn',
'michigan',
'tcot',
'australia',
'opkillingbay']

出现的错误

 YellowbrickValueError                     Traceback (most recent call last)
<ipython-input-114-d6a94f150164> in <module>
7 # Create the visualizer and draw the plot
8 visualizer = DispersionPlot(target_words)
----> 9 visualizer.fit(text)
10 visualizer.poof()

c:\users\hp\appdata\local\programs\python\python37\lib\site-packages\yellowbrick\text\dispersion.py in fit(self, X, y, **kwargs)
171 self.target = points_target[:,2]
172
--> 173 self._check_missing_words(points)
174
175 self.draw(points, self.target)

c:\users\hp\appdata\local\programs\python\python37\lib\site-packages\yellowbrick\text\dispersion.py in _check_missing_words(self, points)
119 "The indexed word '{}' is not found in "
120 "this corpus"
--> 121 ).format(self.indexed_words_[index]))
122
123 def fit(self, X, y=None, **kwargs):

YellowbrickValueError: The indexed word 'wso' is not found in this corpus

最佳答案

我认为 wso 在您的语料库中找不到;只有#wso

你试过像['love']这样的单一目标词吗?你仍然得到错误吗?

关于python - yellowbrick visualiser.fit() 引发 ValueError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55088854/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com