vecs #Double array of numpy
name #label
from sklearn.decomposition import PCA #Principal component analyzer
pca = PCA(n_components=2)
pca.fit(vecs)
x = pca.transform(vecs)
for i in range(len(x)):
X.append(x[j][0])
Y.append(x[j][1])
fig, ax = pyplot.subplots(figsize=(15,15))
ax.scatter(X, Y)
for i, txt in enumerate(Name):
ax.annotate(txt, (X[i], Y[i]))
pyplot.savefig("img.png ") #Save
Results of extracting and visualizing the vector corresponding to the country name from the pre-learning model of Wikipedia2Vec Visualization of country vectors, which was extracted Wikipedia2Vec model.
Recommended Posts