Skip to content

Conversation

@flo-ri-an
Copy link
Contributor

During hyperparameter optimisation of a hiclass classifier, HierarchicalClassifier._create_logger() adds a new StreamHandler to the logger every time a classifier is instantiated. This means that on the nth iteration of a hyperparameter tuning session (or indeed any time a hiclass classifier is instantiated repeatedly) every log line in the console is repeated n times.

By checking if a hander is already set on the logger, we can skip adding another one when _create_logger() is callled

During hyperparameter optimisation of a hiclass classifier, HierarchicalClassifier._create_logger() adds a new StreamHandler to the logger every time it is instantiated. This means that on the nth iteration, every log line in the console is repeated n times.

By checking if a hander is already set on the logger, we can skip adding another one when we call _create_logger()
@mirand863
Copy link
Collaborator

mirand863 commented Jul 26, 2022

Hi @flo-ri-an,

This is a nice contribution! Thank you very much! I am not sure why the tests did not run, but I believe it is safe to merge.

Kind regards,
Fabio

@mirand863 mirand863 merged commit 00a9adb into scikit-learn-contrib:main Jul 26, 2022
@flo-ri-an flo-ri-an deleted the fix-multiple-log-handlers branch July 26, 2022 12:53
@flo-ri-an
Copy link
Contributor Author

You're welcome ;)

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.

2 participants