scikit-learn-intelex
scikit-learn-intelex copied to clipboard
[fix] correct logic k-NN algos ```kneighbors()``` call when ```algorithm='brute'``` and fit with GPU
Description
Calling k-NN algorithms kneighbors()
after fitting with GPU and algorithm = 'brute' will assume that it was fit using daal4py, and will fail in yielding kneighbors. This adds corrections in that check, and a test for kneighbors
without input.
kneighbors
is a bit special because it doesn't require an input to yield numerical results (re-using the fitted X
values). The fit can occur in the daal4py backend or onedal backend. The check for predict
and kneighbors
now will check for which train object was generated, and will use it.
Checklist to comply with before moving PR from draft:
PR completeness and readability
- [x] I have reviewed my changes thoroughly before submitting this pull request.
- [x] I have commented my code, particularly in hard-to-understand areas.
- [x] I have updated the documentation to reflect the changes or created a separate PR with update and provided its number in the description, if necessary.
- [x] Git commit message contains an appropriate signed-off-by string (see CONTRIBUTING.md for details).
- [x] I have added a respective label(s) to PR if I have a permission for that.
- [x] I have resolved any merge conflicts that might occur with the base branch.
Testing
- [x] The unit tests pass successfully.
- [x] I have run it locally and tested the changes extensively.
Performance
- [x] I have measured performance for affected algorithms using scikit-learn_bench and provided at least summary table with measured data, if performance change is expected.
- [x] I have provided justification why performance has changed or why changes are not expected.