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

Reassign pipe logger #242

Closed
janosh opened this issue Oct 9, 2019 · 2 comments · Fixed by #243
Closed

Reassign pipe logger #242

janosh opened this issue Oct 9, 2019 · 2 comments · Fixed by #243

Comments

@janosh
Copy link
Member

janosh commented Oct 9, 2019

When assigning custom loggers during instantiation of a MatPipe, i.e.

import automatminer as amm
import logging

my_logger = logging.getLogger("my_logger")

pipe = amm.MatPipe(logger=my_logger)

I somehow sometimes end up with pipe._logger == None. Haven't quite figured out when exactly that happens. And it only throws after training once I try to pipe.predict with

AttributeError: 'NoneType' object has no attribute 'info'

at self.logger.info. To proceed, I tried to reassign pipe._logger which didn't work at first until propagating that reassignment to all of pipe.(autofeaturizer|cleaner|reducer|learner).

Since you're already using @property for the logger, how about adding a setter to facilitate reassigning the logger?

@janosh
Copy link
Member Author

janosh commented Oct 10, 2019

I just isolated that

pipe.save("mat.pipe")

causes the logger to be removed. If I don't run that before

pipe.predict(df)

everything is fine. If I do, I get

AttributeError: 'NoneType' object has no attribute 'info'

at

self.logger.info("Beginning MatPipe prediction using fitted pipeline.")

@janosh
Copy link
Member Author

janosh commented Oct 10, 2019

Here's the problem. The loggers need to be reassigned after pickling.

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 a pull request may close this issue.

1 participant