-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add K-Nearest Neighbor (KNN) implementation and Test #542
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
Add K-Nearest Neighbor (KNN) implementation and Test #542
Conversation
fa3199f
to
a486ee2
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #542 +/- ##
=======================================
Coverage 96.67% 96.68%
=======================================
Files 279 280 +1
Lines 11013 11059 +46
Branches 1568 1577 +9
=======================================
+ Hits 10647 10692 +45
Misses 232 232
- Partials 134 135 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a K-Nearest Neighbors (KNN) classifier implementation to the machine learning algorithms collection. The implementation includes a generic classifier that can work with any label type and uses Euclidean distance for neighbor calculations.
- Added a complete KNN classifier with proper error handling and validation
- Comprehensive unit tests covering all code paths including edge cases and error conditions
- Updated README to document the new algorithm in the machine learning section
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
README.md | Added KNN entry to the machine learning algorithms list |
Algorithms/MachineLearning/KNearestNeighbors.cs | Complete KNN implementation with generic label support and Euclidean distance calculation |
Algorithms.Tests/MachineLearning/KNearestNeighborsTests.cs | Comprehensive test suite covering all functionality and error cases |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Please resolve Codacy issues |
I'm done, thanks @siriak |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
Summary
K-Nearest Neighbors (KNN) classifier is a commonly used algorithm in Machine Learning/AI
Changes
Unit Test Passed Evidence
Build Passed Evidence