Search code examples
pythonscikit-learndimensionality-reduction

In scikit learn's t-SNE, does changing the metric only influence the metric used in the high dimension or in the target dimension too?


As far as I know, t-SNE calculates distances in both the high dimension and the target dimension spaces, then transforms them to probabilities and tries to converge the target one to the original. My question is, when I change the metric to cosine for example, does that mean that the algorithm will calculate cosine (dis)similarities in the target 2D space as well? Or only in the original high dimensional space, and will use euclidean either way for the 2D? I've looked at the source code, but failed to find the answer.


Solution

  • What is your goal?

    As far as I know, if you set to the t-SNE algorithm a different metric (e.g. cosine distance), it will only calculate the distances in the original high-dimensional space using the new metric.

    The t-SNE algorithm will still use the Euclidean distance in low-dimensional space.