-
Notifications
You must be signed in to change notification settings - Fork 53
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
MNT Sklearn1.6 compatibility #447
MNT Sklearn1.6 compatibility #447
Conversation
Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
Issue in |
This comment was marked as outdated.
This comment was marked as outdated.
Can you get the output with |
Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
The issue is about versioning again, taking care of separating the SGD stuff by sklearn version would most likely solve these last errors. I will look into it today, seems a bit more complex in this case then the rest, at least at first glance. I will ping with questions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would pass tests once scikit-learn/scikit-learn#30356 is merged in sklearn
@@ -46,8 +46,7 @@ def check_file_size() -> None: | |||
set_random_state(estimator, random_state=0) | |||
|
|||
X, y = get_input(estimator) | |||
tags = _safe_tags(estimator) | |||
if tags.get("requires_fit", True): | |||
if get_tags(estimator).requires_fit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scikit-learn now uses dataclasses for tags, which are emulated here for old sklearn as well
Huber, | ||
Log, | ||
LossFunction, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scikit-learn has moved to a more central place for loss functions / classes, and therefore the ones which are used between estimators are removed from the sgd specific file.
from sklearn._loss._loss import ( | ||
CyAbsoluteError, | ||
CyExponentialLoss, | ||
CyHalfBinomialLoss, | ||
CyHalfGammaLoss, | ||
CyHalfMultinomialLoss, | ||
CyHalfPoissonLoss, | ||
CyHalfSquaredError, | ||
CyHalfTweedieLoss, | ||
CyHalfTweedieLossIdentity, | ||
CyHuberLoss, | ||
CyPinballLoss, | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these are the new loss classes
@@ -44,36 +44,38 @@ def _is_steps_like(obj): | |||
return True | |||
|
|||
|
|||
def _assert_generic_objects_equal(val1, val2): | |||
def _assert_generic_objects_equal(val1, val2, path=""): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added the path
argument to give the devs a better verbose idea of where things fail, to debug things easier
skops/io/tests/test_persist.py
Outdated
|
||
# Default settings for X | ||
N_SAMPLES = 50 | ||
N_SAMPLES = 100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an SGD estimator was ill defined with 50 samples, increasing to 100
@adrinjalali any legwork left that you'd like to or can share to make this faster or it is good to go as it is when the changes are merged in sklearn? |
@TamaraAtanasoska what's left is to take all estimators generated by |
do you mean in Edit: I see this not about Should I take it on or you are already working on it? |
No I'm not working on that, you can take it on :) |
BTW, we're working with @glemaitre on this: https://github.com/glemaitre/sklearn-compat |
that is a cool effort! This can get stressful for a lot of folks otherwise |
@adrinjalali there is a
|
Yes, that's exactly the error fixed with the now merged PR. The CI here should be green tomorrow once the nightly build is uploaded / updated. |
@adrinjalali refactor in c3da1b9 with the new changes regarding scikit-learn/scikit-learn#30372 although I guess that will be merged soon. If it gets merged before we merge I'd like to change the code slightly as I had it before as it was nicer :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a whole bunch of fixes here. I think I rather merge this and do other fixes in separate PRs.
Also, it turns out we were NOT testing against old sklearn versions, which is fixed now here, but it makes CI fail on those old ones, but at least they're tested. Also, the nightly build should be fixed (at least I tested locally with a latest version).
Reference Issues/PRs
Fixes #443. Not fully working yet.
What does this implement/fix? Explain your changes.
A few of the compatibility errors, including the one explained in #443 are now fixed. There are some external failures(errors happening outside of
skops
) that I am not sure how to fix. @adrinjalali any tips? Below are the remaining failures:Any other comments?
First PR to the project, the fixes might be off.
I understood #443 as I can remove all
SGD
stuff from the_sklearn.py
file when working withsklearn 1.6+
, tests pass like that, I am just not sure if the change is supposed to be so severe?