Fixes API Deprecate n_alphas in LinearModelCV - #30616
Conversation
adrinjalali
left a comment
There was a problem hiding this comment.
Thanks for the PR.
I left a few comments, please fix the rest of the PR accordingly.
Also, the tests need to be fixed so that they don't raise a warning, and we need explicit tests for the warning and the value error.
| @@ -0,0 +1,13 @@ | |||
| ```rst | |||
There was a problem hiding this comment.
Please have a look at the other changelog entries.
You don't need the triple backtick and the rst tag here, and the lines need to be indented after the first line. Also, you need to rearrange the changelog into a single bullet point and convey the message in that single point.
|
I synchronized with main and addressed the review comments. I made a slight modification because imo we don't want to raise a warning when both params are left to their default value, even though default alphas is "warn". In that case the future default behavior will be 100 which corresponds to the current default behavior. I don't want that users leaving both params to their default value get a warning even though the behavior won't change. I updated the code and tests accordingly. |
Fixes #30467
Updated LinearModelCV and derived classes LassoCV, ElasticNetCV, MultiTaskElasticNetCV, MultiTaskLassoCV to remove
n_alphasparameter from the constructor.alphasparameter is updated to support an integer or array-like argument. Functionality ofn_alphasis preserved by passing an integer toalphas. Parameter_constraints updated accordingly.Unit tests created to verify correct warning messages are raised upon usage of
n_alphasparameter. Unit tests created to verify correct warning message if using the default value ofalphas. All unit tests passing and all warnings suppressed on existing test cases using filter warnings.All classes are backwards compatible with
n_alphasuntil 1.8, before it will be removed. doc_strings updated to effectively communicate changes.