首页 > 解决方案 > 为 Gensim 模型绘制 3D 图

问题描述

我已经使用 Gensim 训练了我的模型。我使用 PCA 绘制了一个 2D 图,但不清楚太多。我想将它更改为能够缩放的 3D。我的结果是如此密集。

from sklearn.decomposition import PCA
from matplotlib import pyplot
X=model[model.wv.vocab]
pca=PCA(n_components=2)
result=pca.fit_transform(X)
pyplot.scatter(result[:,0],result[:,1])
word=list(model.wv.most_similar('eden_lake'))
for i, word in enumerate(words):
  pyplot.annotate(word, xy=(result[i, 0], result[i, 1]))
pyplot.show()

结果: 在此处输入图像描述

有可能这样做吗?

标签: python-3.xpcagensim

解决方案


是的,原则上可以对 LDA 模型结果进行 3D 可视化。是有关为此使用 T-SNE 的更多信息。


推荐阅读