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

Assign __init__ arg to instance attribute to fix sklearn base __repr__ #896

Merged
merged 1 commit into from
Dec 17, 2022

Conversation

ml-evs
Copy link
Collaborator

@ml-evs ml-evs commented Dec 16, 2022

Summary

Closes #864.

Simply turns the desired_features arg to the __init__ of DensityFeatures and GlobalSymmetry into an instance attribute, which prevents a crash when calling __repr__ for the class (something that happens within featurization progress bars). This is because __repr__ is being inherited from the underlying sklearn class that provides introspection into the __init__ arguments of the featurizer.

This PR fixes it in the places I have run into personally, but more may be lurking around. One general fix would be to simply define a custom __repr__ for the base matminer featurizer to avoid using the sklearn one.

@ml-evs
Copy link
Collaborator Author

ml-evs commented Dec 16, 2022

Calling in my debt with @janosh as a potential reviewer, though don't expect anything until next year! 🤪

@janosh
Copy link
Member

janosh commented Dec 17, 2022

@ml-evs Thanks for submitting a fix! I strive to deliver. 😄

@janosh janosh merged commit e1b83b3 into hackingmaterials:main Dec 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AttributeError: 'DensityFeatures' object has no attribute 'desired_features'
2 participants