gimseng / 99-ML-Learning-Projects

A list of 99 machine learning projects for anyone interested to learn from coding and building projects
MIT License
575 stars 173 forks source link

added exercise and basic solution for kNN algorithm #119

Closed divyajyotiuk closed 3 years ago

divyajyotiuk commented 3 years ago

Reference Issues/PRs

This can be a foundation for the #94 issue.

What does this implement/fix? Explain your changes.

Implementation of kNN from scratch and extendible also tasks provided as exercises.

Any other comments?

Beginner friendly algorithm for kNN provided.

gimseng commented 3 years ago

@divyajyotiuk Thanks for the contribution ! Its nice that you coded kNN from scratch. Two suggestions/comments:

  1. Could you put the data in the exercise somehow? I think the best way would be to delete the solutions from the notebook, but kept the beginning part where the data is. You could keep/write some comments to help learners code the algorithm, if you want to.

  2. Do you happen to know how to import knn from sklearn ? I think you could also (maybe at the end of the solution) illustrate how to use the kNN package from sklearn.

divyajyotiuk commented 3 years ago

If I am not wrong, do you want me to [ ] delete the solutions folder altogether ? [ ] Move the sample solution to data folder ? where do I write some comments to help learners code the algorithm - in the sample solution file or make a different file ?

I'll add the second point as you mentioned.

gimseng commented 3 years ago

@divyajyotiuk what I meant was to have another notebook in the exercise folder, which is a copy of your solution notebook, but contain the data and/or part of the rest of the codes (but with comments/suggestions on the codes).

divyajyotiuk commented 3 years ago

I have added starter exercise and also shown an example of using sklearn's knn module.

gimseng commented 3 years ago

Thanks @divyajyotiuk, I'll review it later this week.

gimseng commented 3 years ago

Thanks @divyajyotiuk , I'll merge now.

divyajyotiuk commented 3 years ago

Hey, the file name for scikit learn knn code is wrong. knn_from_scratch.ipynb should be replaced with knn_using_sklearn.ipynb in the solution markdown. https://github.com/gimseng/99-ML-Learning-Projects/tree/master/010/solution

gimseng commented 3 years ago

oops i copied pasted and forgot to change. Thanks @divyajyotiuk !