Skip to content

Instantly share code, notes, and snippets.

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)
# 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]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment