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

Remove event based logging pattern #557

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

adrianmolzon
Copy link
Contributor

Hey all, I'm back with another pull request! This one removes some of the old functionality for saving logs since I've created a better way of saving state. In doing so, I've tried to simplify the file structure, mostly by deleting unnecessary files, but also by moving all the logging methods to a Logger class in logger.py. This class is now invoked on initialization of the BayesianOptimization object, and exposes the steps previously invoked by the Observable pattern, optimization_start, optimization_step, and optimization_end. I think this unification is cleaner. Changes to the format of the Logger can still be made, they are just stored under optimizer.logger.whateveryouwant.

@adrianmolzon adrianmolzon changed the title Logging Remove event based logging pattern Mar 26, 2025
Copy link

codecov bot commented Mar 26, 2025

Codecov Report

Attention: Patch coverage is 98.61111% with 1 line in your changes missing coverage. Please review.

Project coverage is 97.92%. Comparing base (626aafe) to head (6edcb2a).

Files with missing lines Patch % Lines
bayes_opt/logger.py 98.41% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #557      +/-   ##
==========================================
+ Coverage   96.43%   97.92%   +1.49%     
==========================================
  Files          12       10       -2     
  Lines        1235     1158      -77     
==========================================
- Hits         1191     1134      -57     
+ Misses         44       24      -20     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@till-m till-m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's generally great that we're moving on from the observer pattern, however, I think it would be better to not pass in the whole BayesianOptimization object in these steps, but pass the specific relevant information. E.g., in log_optimization_step, we should pass in the params of the point, the target value, constraint-value, if applicable, and a boolean for is_new_max. Similarly, the log_optimization_start function should accept parameter names, etc.

The only argument that I can see against this is if we want to allow people to write their own loggers, but I don't really see a usecase for this.

@till-m
Copy link
Member

till-m commented Apr 7, 2025

@adrianmolzon if you feel like losing your sanity you could also have a look at tackling #515.

@adrianmolzon
Copy link
Contributor Author

@adrianmolzon if you feel like losing your sanity you could also have a look at tackling #515.

Cute, I'll see if I can fix this. Looks like a good time to knock this out

@adrianmolzon
Copy link
Contributor Author

@adrianmolzon if you feel like losing your sanity you could also have a look at tackling #515.

Yeah this sucked but I've made some changes to fix this. To make things easier, any number over a million will be converted into scientific notation, hope this doesn't ruin anybody's day.

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