Skip to content

Conversation

anishk85
Copy link

@anishk85 anishk85 commented Oct 5, 2025


Description

Added K-Nearest Neighbors (KNN) classification algorithm to the machine learning module.

KNN is a supervised learning algorithm that classifies data points based on the majority vote of their k nearest neighbors using Euclidean distance.

Reference: https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I ran below commands using the latest version of rust nightly.
  • I ran cargo clippy --all -- -D warnings just before my last commit and fixed any issue that was found.
  • I ran cargo fmt just before my last commit.
  • I ran cargo test just before my last commit and all tests passed.
  • I added my algorithm to the corresponding mod.rs file within its own folder, and in any parent folder(s).
  • I added my algorithm to DIRECTORY.md with the correct link.
  • I checked CONTRIBUTING.md and my code follows its guidelines.

Note: All 8 tests pass in <50ms (no #[ignore] needed).


@anishk85 anishk85 requested a review from imp2002 as a code owner October 5, 2025 16:37
@codecov-commenter
Copy link

codecov-commenter commented Oct 5, 2025

Codecov Report

❌ Patch coverage is 99.40120% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 95.36%. Comparing base (ed7a42e) to head (fe19414).

Files with missing lines Patch % Lines
src/machine_learning/k_nearest_neighbors.rs 99.39% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #923      +/-   ##
==========================================
+ Coverage   95.32%   95.36%   +0.03%     
==========================================
  Files         319      320       +1     
  Lines       20899    21060     +161     
==========================================
+ Hits        19923    20083     +160     
- Misses        976      977       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@anishk85
Copy link
Author

anishk85 commented Oct 5, 2025

@imp2002 have you merged the files earlier without all workflows cleared because my build is failing because of the earlier issues in files

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.

2 participants