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

Fix SVM model parameter handling in case n_support=0 #4097

Merged

Conversation

tfeher
Copy link
Contributor

@tfeher tfeher commented Jul 26, 2021

Fixes #4033

This PR fixes SVM model parameter handling in case the fitted model has no support vectors, only bias.
C++ side changes:

  • The bias calculation is updated to calculate the bias as the average function value in this case.
  • The prediction function is modified to avoid kernel function calculation in this case.
  • Added an SVR unit test to check model fitting and prediction.

Python side changes:

  • It was incorrectly assumed that n_support==0 means the model is not fitted correctly, this is removed.
  • Model attributes (dual_coef_, support_, support_vectors_) are defined as empty arrays in this case.
  • coef_ attribute is an array of zeros if there are no support vectors.
  • Unit test added to check training prediction and model attributes.

@tfeher tfeher requested review from a team as code owners July 26, 2021 13:52
@github-actions github-actions bot added CUDA/C++ Cython / Python Cython or Python issue labels Jul 26, 2021
@tfeher tfeher added 3 - Ready for Review Ready for review by team bug Something isn't working non-breaking Non-breaking change and removed CUDA/C++ Cython / Python Cython or Python issue labels Jul 26, 2021
@github-actions github-actions bot added CUDA/C++ Cython / Python Cython or Python issue labels Jul 26, 2021
Copy link
Member

@dantegd dantegd left a comment

Choose a reason for hiding this comment

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

Code lgtm

@dantegd dantegd added 5 - Ready to Merge Testing and reviews complete, ready to merge and removed 3 - Ready for Review Ready for review by team labels Jul 26, 2021
@tfeher
Copy link
Contributor Author

tfeher commented Jul 26, 2021

There is an unrelated failure in umap test_umap_mnmg.

@tfeher
Copy link
Contributor Author

tfeher commented Jul 26, 2021

rerun tests

@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (branch-21.08@40af8af). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@               Coverage Diff               @@
##             branch-21.08    #4097   +/-   ##
===============================================
  Coverage                ?   85.81%           
===============================================
  Files                   ?      231           
  Lines                   ?    18269           
  Branches                ?        0           
===============================================
  Hits                    ?    15677           
  Misses                  ?     2592           
  Partials                ?        0           
Flag Coverage Δ
dask 48.17% <0.00%> (?)
non-dask 78.28% <0.00%> (?)

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


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 40af8af...3f9b6e5. Read the comment docs.

@dantegd
Copy link
Member

dantegd commented Jul 26, 2021

@gpucibot merge

@rapids-bot rapids-bot bot merged commit cb32219 into rapidsai:branch-21.08 Jul 26, 2021
vimarsh6739 pushed a commit to vimarsh6739/cuml that referenced this pull request Oct 9, 2023
Fixes rapidsai#4033

This PR fixes SVM model parameter handling in case the fitted model has no support vectors, only bias.
C++ side changes:
- The bias calculation is updated to calculate the bias as the average function value in this case.
- The prediction function is modified to avoid kernel function calculation in this case.
- Added an SVR unit test to check model fitting and prediction.

Python side changes:
- It was incorrectly assumed that n_support==0 means the model is not fitted correctly, this is removed.
- Model attributes (`dual_coef_`, `support_`, `support_vectors_`) are defined as empty arrays in this case.
- `coef_` attribute is an array of zeros if there are no support vectors.
- Unit test added to check training prediction and model attributes.

Authors:
  - Tamas Bela Feher (https://github.com/tfeher)

Approvers:
  - Dante Gama Dessavre (https://github.com/dantegd)

URL: rapidsai#4097
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 - Ready to Merge Testing and reviews complete, ready to merge bug Something isn't working CUDA/C++ Cython / Python Cython or Python issue non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] SVR throwing cuBLAS error during inference
3 participants