Rust icon indicating copy to clipboard operation
Rust copied to clipboard

K nearest neighbors Algorithm

Open haswanth10 opened this issue 1 year ago • 1 comments

This commit adds K-nearest neighbors Algorithm.

Important points regarding Commit:

  1. Euclidean distance is used to compute the distance between 2 points.
  2. Only classification has been implemented by using majority vote amongst k nearest neighbors for an input point
  3. An Enum has been created for distance computation so that it can be extended to other distance computation techniques/formulae like Manhattan Distance, etc.
  4. Classification Label is of type 'String'.

Pull Request Template

Description

Please include a summary of the change and which issue (if any) is fixed. A brief description of the algorithm and your implementation method can be helpful too. If the implemented method/algorithm is not so well-known, it would be helpful to add a link to an article explaining it with more details.

Type of change

Please delete options that are not relevant.

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

Checklist:

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

Please make sure that if there is a test that takes too long to run ( > 300ms), you #[ignore] that or try to optimize your code or make the test easier to run. We have this rule because we have hundreds of tests to run; If each one of them took 300ms, we would have to wait for a long time.

haswanth10 avatar May 21 '24 01:05 haswanth10

Codecov Report

Attention: Patch coverage is 99.56897% with 1 line in your changes missing coverage. Please review.

Project coverage is 95.07%. Comparing base (0b8ba06) to head (56bd101).

Files Patch % Lines
...chine_learning/optimization/k_nearest_neighbors.rs 99.56% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #723      +/-   ##
==========================================
+ Coverage   95.02%   95.07%   +0.04%     
==========================================
  Files         303      304       +1     
  Lines       22577    22809     +232     
==========================================
+ Hits        21454    21685     +231     
- Misses       1123     1124       +1     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar May 21 '24 01:05 codecov-commenter

Hi , i made the changes suggested. Let me know if there is anything else that's needed :)

haswanth10 avatar Jun 06 '24 00:06 haswanth10

This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jul 06 '24 00:07 github-actions[bot]

Please ping one of the maintainers once you commit the changes requested or make improvements on the code. If this is not the case and you need some help, feel free to ask for help in our Gitter channel. Thank you for your contributions!

github-actions[bot] avatar Jul 13 '24 00:07 github-actions[bot]