Skip to content

n_neighbors vs perplexity (API discussion) #283

@dkobak

Description

@dkobak

Hi Pavlin, I met Leland @lmcinnes last week at a workshop in Denmark and he said he thinks openTSNE should transition away from using perplexity to something like n_neighbors because apparently multiple people mentioned to him that the notion of perplexity is confusing. A separate argument (not from Leland but from me) is that default perplexity=30 implies k=90 neighbors which is much slower than what one would have with k=10 or k=15 neighbors.

One possibility of allowing that would be to add n_neighbors parameter into the TSNE() constructor API. If provided, it would override perplexity=30 and use Uniform affinity class with the n_neighbors param. Leland's suggestion would then to actually make n_neighbors=10 or 15 default (instead of perplexity), but that's maybe a bit more radical than what you would want to allow here (?). But one could think about it again in some future version.

The only downsides that I see is one extra param in the class constructor, and also it's not great to have TSNE(perplexity=30, n_neighbors=10) to silently override the perplexity setting. But it'd be nice to make TSNE(n_neighbors=10) possible... Not sure if there is a better way to achieve that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions