python - 使用 PCA 或 t-SNE 和 Matplotlib 测量数据图
问题描述
我的目标是找出我是否可以在 Python 中操作和测量来自 PCA 或 t-SNE 图的数据。我想知道是否有一种方法可以找到点到集群中心的距离。
我认为有办法,但我不太确定。
解决方案
您没有指定太多,但也许这可以帮助您:
聚类技术信息: https ://scikit-learn.org/stable/modules/clustering.html#clustering
降维: https ://scikit-learn.org/stable/modules/decomposition.html#decompositions
也许以下脚本可以帮助您:
from sklearn.decomposition import PCA
X= your_data_variables
cluster = "your cluster technique"
cluster.fit(X)
pca=PCA(n_components= 2)
pca.fit(X)
pca_data = pd.DataFrame(pca.transform(X))
centers = pca.transform(cluster.cluster_centers_)
现在您有了集群中心和二维数据,您可以根据需要计算距离。
推荐阅读
- c++ - 模板依赖 false
- tortoisehg - 仅将 TortoiseHg Workbench 历史记录限制到特定分支
- javascript - 在引导程序中隐藏和显示按钮
- javascript - iContact API 在 JS 谷歌脚本中创建联系人调用
- java - 如何处理 Spring JDBC native Query IN 参数中的 999 大小?
- elasticsearch - 如何在 Elasticsearch 中最好地创建父子关系
- python - 试图理解跨 python 模块的多处理和队列
- python - tkinter,将交互式网格集成到页面中
- scala - 如何在 Jade 中调用 Scala 函数?
- python - 使用 Python 从 GIF 中提取关键帧