FIX validate parameters in fit in all SVM estimators - #21436
Conversation
|
I think that we should add an entry in the changelog since it could have an effect on third-party libraries. Please add an entry to the change log at - |Fix| :class:`smv.SVM` (and add all the other impacted classes) nows validate input parameters in `fit`
instead of `__init__`.
:pr:`21436` by :user:`Haidar Almubarak <Haidar13 >`.It should in the section: :mod:`sklearn.svm` |
glemaitre
left a comment
There was a problem hiding this comment.
Apart from that everything looks good. We already have the proper test calling fit.
fit in all SVM estimators
thomasjpfan
left a comment
There was a problem hiding this comment.
Thank you for the PR @Haidar13 !
|
The last update gave coverage issues for the test. There is scikit-learn/sklearn/svm/tests/test_svm.py Lines 698 to 703 in 6f720c5 Do you want to merge this PR and create another issue/PR for test coverage or put it all in one PR? |
|
No this is better to cover the missing case in this PR. This is related to the PR itself. |
ogrisel
left a comment
There was a problem hiding this comment.
Indeed, please add the missing tests to cover the checks as part of this PR.
Co-authored-by: Guillaume Lemaitre <[email protected]>
Co-authored-by: Olivier Grisel <[email protected]>
|
I just pushed the updated code with the tests added. Just one comment, flake8 did not catch everything that the linter in the Github action complained about. I saw that one of the actions was using black, I installed black and let it reformat the file then everything went well. what linter is used here? |
|
We are using flake8 on the diff and black on all files if I recall well. |
glemaitre
left a comment
There was a problem hiding this comment.
Still my +1. Maybe @ogrisel or @thomasjpfan want to have a look here during the sprint.
ogrisel
left a comment
There was a problem hiding this comment.
Note: I pushed some commits to resolve the conflict with main. Don't forget to pull before adding new changes.
There are missing periods in the error messages (see below). I am also suggesting to use the !r format to use repr(self.gamma) which is more informative than str(self.gamma) in error messages.
The tests will need to be adjusted accordingly. Once done, +1 for merge on my side.
|
Done, periods added and repr is now used to print the gamma instead of str |
…21436) Co-authored-by: Guillaume Lemaitre <[email protected]> Co-authored-by: Olivier Grisel <[email protected]>
…21436) Co-authored-by: Guillaume Lemaitre <[email protected]> Co-authored-by: Olivier Grisel <[email protected]>
Reference Issues/PRs
Addresses #21406
What does this implement/fix? Explain your changes.
Moves ValueError checks from _init_ to fit
Any other comments?
#DataUmbrella