Skip to content
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

Unexpected <class 'AttributeError'>. 'LinearRegression' object has no attribute 'positive #30744

Open
ItsIronOxide opened this issue Jan 31, 2025 · 2 comments
Labels
Needs Reproducible Code Issue requires reproducible code

Comments

@ItsIronOxide
Copy link

ItsIronOxide commented Jan 31, 2025

My team changed to scikit-learn v1.6.1 this week. We had v1.5.1 before. Our code crashes in this exact line with the error "Unexpected <class 'AttributeError'>. 'LinearRegression' object has no attribute 'positive'".

We cannot deploy in production because of this. I am desperate enough to come here to ask for help. I do not understand why it would complain that the attribute does not exist given that we were using v1.5.1 before and the attribute has existed for 4 years now. My only guess is if we are loading a very old pickled model that does not have the attribute, so it crashes here. Unfortunately I cannot share any pieces of code as it is proprietary.

Originally posted by @ItsIronOxide in #30187 (comment)

@github-actions github-actions bot added the Needs Triage Issue requires triage label Jan 31, 2025
@StefanieSenger
Copy link
Contributor

StefanieSenger commented Jan 31, 2025

Hi @ItsIronOxide,

thanks for opening this issue. It really helps though, if you can provide a minimal reproducible including input data. That doesn't need to contain anything proprietary, but rather be a scheme of your way to use scikit-learn models. The only thing that counts is that we see what you did and can re-create the problem.Thank you.

@betatim
Copy link
Member

betatim commented Feb 3, 2025

In addition to what Stefanie said, you mention unpickling estimators from older scikit-learn versions. https://scikit-learn.org/dev/model_persistence.html#replicating-the-training-environment-in-production could be helpful for you - basically: it might work, or maybe not. You should get a specific InconsistentVersion warning to tell you.

Without a code snippet showing what you are trying to do and the resulting traceback it is unfortunately nearly impossible to give concrete advice.

@lesteve lesteve added Needs Reproducible Code Issue requires reproducible code and removed Needs Triage Issue requires triage labels Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Reproducible Code Issue requires reproducible code
Projects
None yet
Development

No branches or pull requests

4 participants