Skip to content

Conversation

Khansa435
Copy link
Contributor

Description:

This PR has added a complete educational workthrough of (t-SNE) t-distributed Stochastic Neighbor Embedding for students.

  • Added t-SNE for nonlinear dimensionality reduction.
  • Computes high- and low-dimensional affinities (P & Q matrices).
  • Uses gradient descent to optimize embeddings.
  • Applied on Iris dataset with 2D visualization.
  • Includes doctests and clear function structure.
  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Add or change doctests? -- Note: Please avoid changing both code and tests in a single pull request.
  • Documentation change?

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 #ISSUE-NUMBER".

@algorithms-keeper algorithms-keeper bot added the awaiting reviews This PR is ready to be reviewed label Oct 13, 2025
@Khansa435
Copy link
Contributor Author

Hi @cclauss My PR has passed all checks and is marked as “awaiting review”.
Could you please take a look when you have time?

I'm really glad to contribute to this highly maintained repo :)

@cclauss
Copy link
Member

cclauss commented Oct 14, 2025

Please read about descriptive variable names in CONTRIBUTING.md. Lines like pq = p - q look like they were written in the 1970's and convey nothing to the reader. Single-letter variable names are not accepted in this repository

@Khansa435
Copy link
Contributor Author

@cclaus Should I remove those "Example " lines from the following code too or just that specific one you mentioned?

@algorithms-keeper algorithms-keeper bot added the tests are failing Do not merge until tests pass label Oct 14, 2025
@cclauss
Copy link
Member

cclauss commented Oct 14, 2025

Please remove all instances of Example: and dedent the lines below. The reason is that we have more characters to write our doctests, so we can use ellipses less.

@Nikita-Kedari
Copy link

@Khansa435 I have opened Issue for this algorithm and am working on the same

@cclauss cclauss changed the title Add t-SNE algorithm using Iris dataset (Fixes # 13432) Add t-SNE algorithm using Iris dataset Oct 14, 2025
@cclauss cclauss changed the title Add t-SNE algorithm using Iris dataset Add t_stochastic neighbour embedding using Iris dataset Oct 14, 2025
@cclauss cclauss changed the title Add t_stochastic neighbour embedding using Iris dataset Add t stochastic neighbour embedding using Iris dataset Oct 14, 2025
@cclauss
Copy link
Member

cclauss commented Oct 14, 2025

Add the URL https://en.wikipedia.org/wiki/T-distributed_stochastic_neighbor_embedding to the top of the file to help readers learn.

Co-authored-by: Christian Clauss <cclauss@me.com>
@algorithms-keeper algorithms-keeper bot removed the tests are failing Do not merge until tests pass label Oct 14, 2025
@Khansa435
Copy link
Contributor Author

@cclauss Committed all proposed changes (Removed all instances of Example: and dedented the lines below, also added URL at the top of file) and the final commit passes all checks.

Please review the final commit :)

@algorithms-keeper algorithms-keeper bot removed the awaiting reviews This PR is ready to be reviewed label Oct 14, 2025
@cclauss cclauss merged commit 709c18e into TheAlgorithms:master Oct 14, 2025
3 of 4 checks passed
@cclauss
Copy link
Member

cclauss commented Oct 14, 2025

Awesome!!!

@Khansa435
Copy link
Contributor Author

Awesome!!!

Thank you so much :)
Your way of guidance is truly commendable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants