Deepak Das
Deepak Das

Reputation: 41

yellowbrick visualiser.fit() raises ValueError

I am trying you Visualise a dispersion plot for my twitter data

Here is the link to the datset

dataset

This is the code

from yellowbrick.text import DispersionPlot

text = combine['tweet']
target_words = ht_negative_unnest

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

I'm trying to pass a list like this in the above code stored in ht_negative_unnest

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

The error raised

 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

Upvotes: 2

Views: 241

Answers (1)

larrywgray
larrywgray

Reputation: 1023

I think wso isn't found in your corpus; only #wso.

Have you tried a single target word like ['love']? Do you still get the error?

Upvotes: 3

Related Questions