vsha96 / mllib

Machine Learning in Haskell
BSD 3-Clause "New" or "Revised" License
29 stars 1 forks source link

remake src/Mllib/Classification/KNN.hs #7

Open vsha96 opened 2 years ago

vsha96 commented 2 years ago

We need to remake the KNN model according to the basic principles (see more in contributing guidelines)

s1m0000n commented 2 years ago

Would like to start working on this. So, I basically need to make sure everything follows these guidelines https://kowainik.github.io/posts/2019-02-06-style-guide? And also resolve the TODOs? Anything else or that's it?

vsha96 commented 2 years ago

@s1m0000n yes, try to follow the code style in the guidelines (basic principles) and do remake of KNN It will be great if you close TODOs that related to metrics from Metric.hs, without weights, because it may require much more changes So you need to add the ability to select a metric , the default metric should be Euclidean

I expect that the data type KNeighborsParams should appear (like in KMeans) with the default parameters in the block of main functions Therefore, the fitting function for the KNN model might be called like this

Old version:

fitKNeighbors 3 {-number of neighs-} x y

New version:

fitKNeighbors KNeighborsParams{n=3 {-number of neighs-}} x y
-- | example with ability to change metric
import Mllib.Metrics (chebyshevDistance)
...
fitKNeighbors KNeighborsParams{n=5, metric=chebyshevDistance} x y

Feel free to change names of funcs and constants etc if you think it would be better

s1m0000n commented 1 year ago

You can assign me back as I'm returning to work & starting with this task again =)