Closed StevenBorg closed 5 years ago
Thanks for the report. I'll have a look at this tomorrow. I ran things on Linux, but I have a macbook here too - it could just me being sloppy.
I think the notebook is missing a line of code.
@StevenBorg if you add the following line of code prior to cell 8 it should run:
inverse_vocab = {idx: word for word, idx in tfidf_vec.vocabulary_.items()}
I think the notebook is missing a line of code. @StevenBorg if you add the following line of code prior to cell 8 it should run:
inverse_vocab = {idx: word for word, idx in tfidf_vec.vocabulary_.items()}
Nice, now it work
Thanks. Updating.
In 07.1 Text Classification.ipynb, cell 8, the call to inverse_vocab fails as not
from collections import Counter, defaultdict by_cls = defaultdict(Counter) for word_idx, pred in enumerate(word_pred): for class_idx, score in enumerate(pred): cls = labelencoder.classes[class_idx] by_cls[cls][inverse_vocab[word_idx]] = score
results in
NameError Traceback (most recent call last)