Skip to content

Conversation

wishmaster815
Copy link

@wishmaster815 wishmaster815 commented Oct 16, 2025

Enhance t-SNE script: visualization, reproducibility, and parameter transparency (#13513)

This PR improves the t_stochastic_neighbour_embedding.py script by making it more user-friendly and reproducible:

  • Added matplotlib scatter plot to visualize t-SNE results.
  • Introduced random_state for consistent outputs.
  • Exposed perplexity, learning_rate, and max_iter parameters for easier experimentation.
  • Added import error handling for sklearn and matplotlib.
  • Fixed doctest by replacing n_iter with max_iter.

These enhancements help learners understand and use t-SNE more effectively.

Screenshot

Here is an example output after running the script:

image

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms include at least one URL that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues then the description above includes the issue number(s) with a closing keyword: "Fixes Feedback on t-SNE script: ideas to improve clarity and usability #13513".

@algorithms-keeper algorithms-keeper bot added the tests are failing Do not merge until tests pass label Oct 16, 2025
@algorithms-keeper algorithms-keeper bot added the awaiting reviews This PR is ready to be reviewed label Oct 16, 2025
@algorithms-keeper algorithms-keeper bot removed the tests are failing Do not merge until tests pass label Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviews This PR is ready to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feedback on t-SNE script: ideas to improve clarity and usability

1 participant