-
Notifications
You must be signed in to change notification settings - Fork 47
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
Refactor surrogates and decorators #209
Conversation
Hi @AVHopp, @Scienfitz, this PR sits on top of another, so let's wait with the review until the other is merged. |
339b15c
to
3784326
Compare
@AVHopp @Scienfitz: now that #206 is merged, have rebased and is ready for review 🚀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for that PR :) I have some comments, but nothing too serious.
f4d500b
to
deb9743
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we might need some in-person discussion about some stuff since I am not sure if I understand your arguments and disagree with them.
Some progress towards refactoring the acqf interface and enabling more advanced acqfs Done - removed `debotorchize` - incldued some new acqfs, see CHANGELOG - enable iteration tests with all acqfs - extended hypothesis tests Not Done Yet: - removing `AdapterModel` (does not make sense while #209 is open) Issues: - ~~some tests with custom surrogates fail, see separate thread~~ resolved since not using botorch factory anymore - some of the analytical new acqfs dont seem to work wiht out GP model. Eg when I implement the `NEI` I get `botorch.exceptions.errors.UnsupportedError: Only SingleTaskGP models with known observation noise are currently supported for fantasy-based NEI & LogNE`. Also the `LogPI` is available in botorch, but it is not imported to the top level acqf package in botorch, I ignored it here. ~~I included a reverted commit pair so it can be checked out quickly to reproduce~~
530f17c
to
b3a4572
Compare
The old approach was unnecessarily complex and resulted in various problems (i.e. typing issues, duplication of subclasses, etc). The new approach simply exchanges the class' methods (and thus modifies the original class) instead of creating a new one. This requires significantly less and easier code an avoids the aforementioned problems.
The reason is the same as for the refactor of catch_constant_targets in the previous commit.
b3a4572
to
bfad013
Compare
This PR refactors our surrogate package, which significantly removes boilerplate/workaround code and solves several longstanding issues:
catch_constant_targets
andscale_model
decorators have been drastically reduced/improved. Most importantly, they no longer cause problems in the subclass hierarchy, which allows us to remove many ugly workarounds with serialization hooks, the docs, typing, ...Note: Potentially the
scale_model
decorator might vanish entirely when refactoring scaling, but this already serves as a preparation as the decorator can now be cleanly removed without other side-effects.The_model
attribute has been pulled up the base class and is now correctly handled in serialization and equality checks.