Skip to content

Conversation

@SnigdhaSarkar16
Copy link

This PR introduces a new poly_kernel interface in the sklearnex.svm module that wraps the existing oneDAL poly_kernel implementation.

The function supports X, Y, gamma, coef0, degree, and optional SYCL queue.

Includes tests in sklearnex/svm/tests/test_poly_kernel_sklearnex.py to validate correctness.

All code passes pre-commit checks, including black, isort, and numpydoc.

This enhancement allows Scikit-learn users to leverage the oneDAL backend for polynomial kernel computations via sklearnex.

Signed-off-by: SnigdhaSarkar16 <sarkarsnigdha16@gmail.com>
Signed-off-by: SnigdhaSarkar16 <sarkarsnigdha16@gmail.com>
@codecov
Copy link

codecov bot commented Oct 20, 2025

Codecov Report

❌ Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
sklearnex/svm/poly_kernel.py 80.00% 1 Missing and 1 partial ⚠️
Flag Coverage Δ
azure 80.47% <80.00%> (-0.01%) ⬇️
github 82.07% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sklearnex/svm/poly_kernel.py 80.00% <80.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@icfaust icfaust left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @SnigdhaSarkar16 this is a great start! It needs to be able to interface with scikit-learn's polynomial_kernel for proper full support outside of the oneDAL acceleration. This requires importing and referring to polynomial_kernel (https://scikit-learn.org/stable/modules/generated/sklearn.metrics.pairwise.polynomial_kernel.html). For example, the onedal version doesn't support sparse inputs, so we will need it to fall back to scikit-learn in those circumstances. You can start by replicating the signature from scikit-learn's polynomial_kernel and adapting it to onedal.primitives.kernel_functions.poly_kernel. Let me know if you have any other questions!

@SnigdhaSarkar16
Copy link
Author

Hi @icfaust Thank you for the feedback! I understand that the poly_kernel function should interface with scikit-learn’s polynomial_kernel to handle sparse inputs and replicate its signature. I’ll update the code accordingly and add appropriate tests.
Thankyou!!!

@SnigdhaSarkar16 SnigdhaSarkar16 force-pushed the add-sklearnex-polynomial branch from 465915f to 8e8df99 Compare October 20, 2025 13:21
@SnigdhaSarkar16 SnigdhaSarkar16 force-pushed the add-sklearnex-polynomial branch from 8e8df99 to a7cfaf9 Compare October 20, 2025 13:25
@SnigdhaSarkar16
Copy link
Author

Hey @icfaust , just checking in , all checks except docs are green. Should I do anything to fix the docs build, or can it be merged as is?

@icfaust
Copy link
Contributor

icfaust commented Oct 22, 2025

@SnigdhaSarkar16 sorry this will require more work on this than its current form. I recommend getting acquainted with our checklist

<!--
PR should start as a draft, then move to ready for review state
after CI is passed and all applicable checkboxes are closed.
This approach ensures that reviewers don't spend extra time asking for regular requirements.

You can remove a checkbox as not applicable only if it doesn't relate to this PR in any way.
For example, a PR with docs update doesn't require checkboxes for performance
while a PR with any change in actual code should list checkboxes and
justify how this code change is expected to affect performance (or justification should be self-evident).
-->

<details>
<summary>Checklist:</summary>

**Completeness and readability**

- [ ] I have commented my code, particularly in hard-to-understand areas.
- [ ] I have updated the documentation to reflect the changes or created a separate PR with updates and provided its number in the description, if necessary.
- [ ] Git commit message contains an appropriate signed-off-by string _(see [CONTRIBUTING.md](https://github.com/uxlfoundation/scikit-learn-intelex/blob/main/CONTRIBUTING.md#pull-requests) for details)_.
- [ ] I have resolved any merge conflicts that might occur with the base branch.

**Testing**

- [ ] I have run it locally and tested the changes extensively.
- [ ] All CI jobs are green or I have provided justification why they aren't.
- [ ] I have extended testing suite if new functionality was introduced in this PR.

**Performance**

- [ ] I have measured performance for affected algorithms using [scikit-learn_bench](https://github.com/IntelPython/scikit-learn_bench) and provided at least a summary table with measured data, if performance change is expected.
- [ ] I have provided justification why performance and/or quality metrics have changed or why changes are not expected.
- [ ] I have extended the benchmarking suite and provided a corresponding scikit-learn_bench PR if new measurable functionality was introduced in this PR.

</details>

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.

2 participants