-
Notifications
You must be signed in to change notification settings - Fork 540
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix SVM model parameter handling in case n_support=0 (#4097)
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. Authors: - Tamas Bela Feher (https://github.com/tfeher) Approvers: - Dante Gama Dessavre (https://github.com/dantegd) URL: #4097
- Loading branch information
Showing
6 changed files
with
104 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters