Skip to content

Instantly share code, notes, and snippets.

@prateekjoshi565
Created November 3, 2019 10:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prateekjoshi565/a84483c40a3ca7972df6a6876de0cf52 to your computer and use it in GitHub Desktop.
Save prateekjoshi565/a84483c40a3ca7972df6a6876de0cf52 to your computer and use it in GitHub Desktop.
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