Skip to content
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

Splitted RadiusNearestNeighbors module into RNNClassifier and RNNRegressor #296

Merged
merged 5 commits into from
Sep 10, 2024

Conversation

norm4nn
Copy link
Contributor

@norm4nn norm4nn commented Aug 21, 2024

Following up on #266 - splitted RadiusNearestNeighbors module intoto RNNClassifier and RNNRegressor modules

@josevalim
Copy link
Contributor

Thank you, it looks good to me as a first step! Next we need to look at the failures and tests. :)

@krstopro
Copy link
Member

krstopro commented Sep 8, 2024

Hi @norm4nn and sorry for the rather delayed review! This looks OK so far, though I am not sure about the approach.

More precisely, I am not sure if we should be having separate modules for Radius Nearest Neighbor Classifier and Regressor or if we should just add the radius parameter to k-NN Classifier and Regressor. I know the issue says to split the existing module into two, but now I am hesitant about that. @josevalim any thoughts on this?

@josevalim
Copy link
Contributor

How many of the existing options in knn classifier play well with the radius one? My understanding is that it is only a subset of them and that the algorithms are different?

@krstopro
Copy link
Member

krstopro commented Sep 9, 2024

How many of the existing options in knn classifier play well with the radius one? My understanding is that it is only a subset of them and that the algorithms are different?

Indeed, the algorithms are different:

  • k-NN makes a prediction based on k-nearest neighbors
  • radius nearest neighbors makes a prediction based on all neighbors within a certain radius

The only way to implement the latter using Nx is to look at all the distances and take only those points that are within the radius. Therefore, this works only with the brute-force algorithm.

I guess having separate modules is fine, but they should not have the algorithm option.

@josevalim josevalim closed this Sep 9, 2024
@josevalim josevalim reopened this Sep 9, 2024
@josevalim
Copy link
Contributor

@norm4nn we can go ahead, but I think we need to fix DBSCAN suite, it may rely on the previous models. Can you please take a look?

@krstopro
Copy link
Member

krstopro commented Sep 9, 2024

@norm4nn we can go ahead, but I think we need to fix DBSCAN suite, it may rely on the previous models. Can you please take a look?

Wrong PR?

@josevalim
Copy link
Contributor

I believe it is the right PR. CI is failing because tests (DBSCAN?) cannot find Scholar.Neighbors.RadiusNearestNeighbors. :)

@krstopro
Copy link
Member

krstopro commented Sep 9, 2024

I believe it is the right PR. CI is failing because tests (DBSCAN?) cannot find Scholar.Neighbors.RadiusNearestNeighbors. :)

Oh, sorry! The reason I asked is because DBSCAN is mentioned in the other PR.

@norm4nn
Copy link
Contributor Author

norm4nn commented Sep 9, 2024

Sure, I will look on this

@josevalim
Copy link
Contributor

There are tiny syntax errors on the doctests and we should be good to go!

@josevalim josevalim merged commit 1765930 into elixir-nx:main Sep 10, 2024
2 checks passed
@josevalim
Copy link
Contributor

💚 💙 💜 💛 ❤️

@josevalim
Copy link
Contributor

@norm4nn btw, i pushed a better fix for doctests here: 4dec8ba :) what you did basically skipped them from comparing results :)

@krstopro
Copy link
Member

krstopro commented Sep 10, 2024

I would suggest changing the module names (and maybe file names as well) to RadiusNeighborsClassifier and RadiusNeighborsRegressor just to avoid the confusion with recurrent neural networks (RNN usually stands for recurrent neural networks in machine learning context).

@josevalim
Copy link
Contributor

Good point, I went with RadiusNN for now :)

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.

3 participants