FIX Added validation for TSNE.perplexity against data - #23471
Conversation
As per the t-sne implementation, any perplexity value larger than the number of samples is mathematically incorrect and should result in an error. Current behavior when perplexity is larger than n_sample results in a seemingly structured, but in reality broken, output. See SO link for examples: https://stats.stackexchange.com/questions/332370/why-do-i-get-weird-results-when-using-high-perpexity-in-t-sne
fixed test to work with perplexity value limit
TSNE.perplexity against dataTSNE.perplexity against data
|
For reference: https://www.jmlr.org/papers/volume9/vandermaaten08a/vandermaaten08a.pdf The paper details that perplexity is used in defining a search criterion for the parameter Edit: By the exact same reasoning, perplexity should overall be bound within Edit: Linking back to the original stack overflow question referenced for this issue as an empirical study: https://stats.stackexchange.com/questions/332370/why-do-i-get-weird-results-when-using-high-perpexity-in-t-sne |
Co-authored-by: Thomas J. Fan <[email protected]>
…cikit-learn into perplexity_validation
|
Thanks @Micky774 |
…cikit-learn#23471) Co-authored-by: Mathias Andersen <[email protected]> Co-authored-by: Thomas J. Fan <[email protected]>
…cikit-learn#23471) Co-authored-by: Mathias Andersen <[email protected]> Co-authored-by: Thomas J. Fan <[email protected]>
…23471) Co-authored-by: Mathias Andersen <[email protected]> Co-authored-by: Thomas J. Fan <[email protected]>
Reference Issues/PRs
Resolves #10805
What does this implement/fix? Explain your changes.
PR #10805: Adds a check for
perplexity>n_samplesThis PR: Adds test, improves validation check
Any other comments?
I also wanted to add a check that
perplexity>=1(since perplexity is2^entropyhence must be >=0) but that would be handled better as a separate PR, and potentially as a part of addressing #23462