-
Notifications
You must be signed in to change notification settings - Fork 160
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
Can't clone LinearGAM estimator object for sklearn cross-validation #291
Comments
Same error here! |
I am having this issue as well |
Working on this right now. It seems like this has to do with a small bug in the I tried the examples shared by @vmgustavo and got no runtime errors: Example 1 from sklearn.model_selection import cross_validate
from pygam import LinearGAM, s
from pygam.datasets import toy_interaction
X, y = toy_interaction(return_X_y=True)
gam = LinearGAM(s(0, by=1))
cross_validate(gam, X, y, cv=5, scoring='neg_mean_absolute_error') Example 2 from sklearn.base import clone
from pygam import LinearGAM, GammaGAM, InvGaussGAM, LogisticGAM, PoissonGAM, ExpectileGAM
for estimator in [LinearGAM, GammaGAM, InvGaussGAM, LogisticGAM, PoissonGAM, ExpectileGAM]:
try:
clone(estimator())
except Exception as e:
print(estimator.__name__, e.__class__.__name__) Environment Python 3.6.13 Issue seems to be fixed so I will submit PR shortly. |
…oning LinearGAM)
Just noticed that there was an open PR addressing this as well as the mutable default callbacks values: |
It doesn't work.
|
Hi, to confirm, has the issue been fixed in any new release? I still see the problem so to confirm if the issue is fixed in any release |
+1 I can also confirm this. Lines 2448 to 2469 in a6c14e4
|
Bug
Can't use LinearGAM with ScikitLearn cross_validate as it get's a RuntimeError for not being able to clone the model.
The only estimator out of all the GAM options that can't be cloned is LinearGAM
To Reproduce
Environment
Python 3.8.5
pygam==0.8.0
The text was updated successfully, but these errors were encountered: