You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suggested modifications for modern-nlp-in-python/executable/Modern_NLP_in_Python.ipynb:
# Change tuple reference in sorted to use third term rather than multi-parameter lamba func:
ordered_vocab = sorted(ordered_vocab, key=lambda x: -x[2])
# Change 'w' to 'wb' when writing binary pickle file:
with open(tsne_filepath, 'wb') as f:
# Add 'rb' as argument rather than default argument:
with open(tsne_filepath, 'rb') as f:
# --------------------------------------
# bokeh unfortunately is not working when I pull this up so we do not get to see the visualization
# Tetsted with my own data (rather than yelp data), this code may help someone get started:
%matplotlib inline
import matplotlib.pyplot as plt
tsne_vectors.plot.scatter('x_coord', 'y_coord', figsize=(14,14))
ax = plt.gca()
for cntr, txt in enumerate(tsne_vectors.index):
ax.annotate(txt, (tsne_vectors[tsne_vectors.index==txt].x_coord, tsne_vectors[tsne_vectors.index==txt].y_coord))
if cntr > 50:
# for demo purposes label an arbitrary set of points
break
plt.show()
The text was updated successfully, but these errors were encountered:
Suggested modifications for modern-nlp-in-python/executable/Modern_NLP_in_Python.ipynb:
The text was updated successfully, but these errors were encountered: