Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add k-nearest neighbors algorithm #2416

Merged
merged 8 commits into from
Jan 31, 2023

Conversation

luizcarloscf
Copy link
Contributor

Description of Change

Checklist

  • Added description of change
  • Added file name matches File name guidelines
  • Added tests and example, test must pass
  • Added documentation so that the program is self-explanatory and educational - Doxygen guidelines
  • Relevant documentation/comments is changed or added
  • PR title follows semantic commit guidelines
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • I acknowledge that all my contributions will be made under the project's license.

Notes:

@Panquesito7 Panquesito7 added the enhancement New feature or request label Jan 17, 2023
Panquesito7
Panquesito7 previously approved these changes Jan 18, 2023
machine_learning/k_nearest_neighbors.cpp Outdated Show resolved Hide resolved
Copy link
Member

@Panquesito7 Panquesito7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work! Thank you so much. 🚀

@luizcarloscf
Copy link
Contributor Author

Thank you! When I have more spare time I'm thinking of contributing more machine learning algorithms. I'm taking a class in college about machine learning and it's really cool to implement the algorithms in languages ​​like Cpp. Hope you like it!

@luizcarloscf
Copy link
Contributor Author

Hey @Panquesito7 ,

I was looking at the organization's repositories and had a question. Some machine learning algorithms can be used for both classification and regression tasks, such as K-Nearest Neighbors or Decision Trees. At TheAlgorithms/Python, there seems to be some distinction in the filenames, but not very clear.

That said, it would make sense to rename the file here like k_nearest_neighbors_classifier.cpp? or just increment like k_nearest_neighbors2.cpp if in the future someone implement a regression version?

Although the core algorithm is the same, when applied to a regression task the final algorithm has some differences from the one applied to a classification task. E.g: KNeighborsRegressor and KNeighborsClassifier

@Panquesito7
Copy link
Member

I think it's fine to keep the name as-is, not sure what the others think, though.

@Panquesito7 Panquesito7 merged commit a8af29b into TheAlgorithms:master Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants