为 scikit-learn 中的 t 分布随机邻域嵌入 (TSNE) 提供起始位置

Provide Starting Positions to t-distributed Stochastic Neighbor Embedding (TSNE) in scikit-learn

我一直在研究使用 scikit learns 的 TSNE 方法来可视化 2D 中的高维数据。但是,我对 2D space 中起始位置的位置有所了解,但我看不到任何指定此信息的方法。有什么想法可以提供起始坐标吗?

我看到有一个 "init" 参数,但它似乎只接受 "random" 或 "pca" 作为选项。我正在寻找的是一种准确指定初始坐标的方法。

更新

我试图增加我的数据点之间的距离(~6,500 点),但它们非常紧密地聚集和重叠。使用默认参数,我得到:

model = sklearn.manifold.TSNE(n_components=2, random_state=0)

n_iter 和 early_exaggeration 的轻微增加并没有产生显着不同的结果,因为点(在集群内)仍然重叠。

model = sklearn.manifold.TSNE(n_components=2, random_state=0, n_iter=10000, early_exaggeration=10)

然而,将 early_exaggeration 从 10 增加到 100(根据文档,这应该会增加集群之间的距离)产生了一些意想不到的结果(我 运行 这两次,这是同样的结果):

model = sklearn.manifold.TSNE(n_components=2, random_state=0, n_iter=10000, early_exaggeration=100)

此 link:https://beta.oreilly.com/learning/an-illustrated-introduction-to-the-t-sne-algorithm 提供了一个示例(页面向下四分之三),说明如何猴子修补 gradient_descent 函数以保存 coordinates/positions。

Added Issue to scikit-learn

目前不可能,但这将是两行更改。 我认为这是一个很好的补充,我们确实支持 init=array 之类的东西,比如 k-means。所以欢迎PR。