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
@wiroking
Copy link

Hi @wishmaster815, awesome improvements! 🎉
The visualization and parameter transparency make the t-SNE script much more user-friendly.
I'm learning Python and data visualization myself, and I'm thinking about contributing similar enhancements.
Are there any other algorithms in the repo that could use the same kind of upgrade?
Thanks for the inspiration – this is perfect for Hacktoberfest!

@wishmaster815
Copy link
Author

wishmaster815 commented Oct 22, 2025

Hi @wiroking thank you for the issue
I'm new into open source and learnt couple of new things with this issue on how production level things work
I surfing and will share something similar if I'll get 👍

Meanwhile if you are satisfied with my work, can you please close the issue by assigning it to me🙂
It can help me in my portfolio building ✨

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

2 participants