hackingmaterials / matminer

Data mining for materials science
https://hackingmaterials.github.io/matminer/
Other
480 stars 194 forks source link

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

Closed ml-evs closed 1 year ago

ml-evs commented 1 year ago

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 commented 1 year ago

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

janosh commented 1 year ago

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