是否可以在大型稀疏矩阵上使用 scikit TSNE?

Is it possible to use scikit TSNE on a large sparse matrix?

scikit documentation 说明 fit_transform 只能用于密集矩阵,但我有一个 csr 格式的稀疏矩阵,我想对其执行 tsne。文档说对稀疏矩阵使用 fit 方法,但这不是 return 低维嵌入。

我很感激我可以像 this question 那样使用 .todense() 方法,但是我的数据集非常大(0.4*10^6 行和 0.5*10^4 列)所以不适合在记忆中。真的,使用稀疏矩阵来做这件事会很好。有没有办法使用 scikit TSNE(或 TSNE 的任何其他 python 实现)来减少大型稀疏矩阵的维数和 return 低维嵌入然后可视化?

来自同一文档:

It is highly recommended to use another dimensionality reduction method (e.g. PCA for dense data or TruncatedSVD for sparse data) to reduce the number of dimensions to a reasonable amount (e.g. 50) if the number of features is very high. This will suppress some noise and speed up the computation of pairwise distances between samples.

改用sklearn.decomposition.TruncatedSVD