Post
2600
nevmenandr/w2v-chess
biblically accurate angel
import gensim
from sklearn.decomposition import PCA
import matplotlib
import matplotlib.pyplot as plt
model = gensim.models.Word2Vec.load('white_moves.model')
dict_moves = model.wv.vocab
dict_moves_appr = {}
for k in dict_moves:
if not k.startswith('->'):
continue
dict_moves_appr[k] = dict_moves[k]
X = model[model.wv.vocab]
pca = PCA(n_components=2)
result = pca.fit_transform(X)
fig, ax = plt.subplots()
ax.plot(Y[:, 0], Y[:, 1], 'o')
ax.set_title('White moves')
lab = list(dict_moves_appr)
for i, lb in enumerate(lab):
plt.annotate(lb, xy=(Y[i, 0], Y[i, 1]))
plt.show()
biblically accurate angel