Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def plot_nodes(word_list):
X = model[word_list]
# reduce dimensions to 2
pca = PCA(n_components=2)
result = pca.fit_transform(X)
plt.figure(figsize=(12,9))
# create a scatter plot of the projection
plt.scatter(result[:, 0], result[:, 1])
for i, word in enumerate(word_list):
plt.annotate(word, xy=(result[i, 0], result[i, 1]))
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.