文档聚类与可视化

2024-09-27 22:19:07 发布

您现在位置:Python中文网/ 问答频道 /正文

我想测试一组文档是否有一些特殊的相似性,查看一个用每个文档的向量表示构建的图,并与其他文档的文本数据集一起显示。我想他们会在一起的。在

解决方案是使用doc2vec计算每个文档的向量并绘制它?能在无人监督的情况下完成吗?我应该使用哪个python库来获得Word2vec的那些漂亮的2D和3D表示?在


Tags: 数据文档文本绘制情况word2vec解决方案相似性
1条回答
网友
1楼 · 发布于 2024-09-27 22:19:07

不知道你问的是什么,但如果你想要一种方法来检查向量是否属于同一类型,你可以使用K均值。 K-意味着从一个向量列表中选出一个K个簇,所以如果你选择一个好的K(不要太低,它会搜索到一些东西,但是不要太高,所以它不会太有区别),它可以工作。在

K-表示工作非常辛苦:

init_center(K) # randomly set K vector that will be the center of your cluster

while not converge(): # This one is tricky as you can find a lot of way to check for the convergence, the easiest is to check if your center has moved since the last itteration

    associate_vector() # Here you associate all the vectors to the closest center

    re_calculate_center() # And now you put the center at the... well center of their point, you can do that just by doing the mean of all the vector of the cluster.

这个gif可能比我更清楚: Gif K-mean

这篇文章(gif的来源)比我更清楚,即使他在这里说的是java: https://picoledelimao.github.io/blog/2016/03/12/multithreaded-k-means-in-java/

相关问题 更多 >

    热门问题