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

Make batch_limit and maxiter configurable #380

Merged
merged 11 commits into from
Mar 20, 2024
Merged

Conversation

jduerholt
Copy link
Contributor

This PR implements the following:

  • make batch_limit and maxiter which are optimizer hyperparams for botorch based strategies configurable in the data model
  • move num_sobol_samples from the strategy data model to acqusition function data model as it is a parameter of the acqf.

@jduerholt jduerholt marked this pull request as draft March 19, 2024 14:18
@jduerholt jduerholt marked this pull request as ready for review March 19, 2024 15:18
Copy link
Contributor

@bertiqwerty bertiqwerty left a comment

Choose a reason for hiding this comment

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

Thanks, Johannes. Just a few minor comments.

bofire/strategies/predictives/botorch.py Show resolved Hide resolved
bofire/data_models/types.py Outdated Show resolved Hide resolved
bofire/strategies/predictives/botorch.py Show resolved Hide resolved
bofire/strategies/predictives/botorch.py Show resolved Hide resolved
type: Literal["qPI"] = "qPI"
tau: PositiveFloat = 1e-3


class qEHVI(MultiObjectiveAcquisitionFunction):
class qEHVI(MultiObjectiveAcquisitionFunction, MCAcquisitionFunction):
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you add a parameter via inheritance? I would just put the parameter there. As in the case of alpha. If you really want to gather the MCAcquisitionFunction parameters somehow because you expect to add more parameters to MCAcquisitionFunction in the near future, at least do it via aggregation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, why not adding the param via inheritance? And what do you mean by aggregation?

Copy link
Contributor

@bertiqwerty bertiqwerty Mar 20, 2024

Choose a reason for hiding this comment

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

I personally think we should keep the code as simple as possible. Currently, I think, it is hard to read. You look at the data model and want to see the parameters. But there are none. I very often have a hard time to find the class that actually implements the functionality I am looking for in BoFire due to its deep inheritance hierarchy. Ok, readability is subjective.

With aggregation I meant composition. I would only use inheritance if I want to make use of polymorphism but not just to save some characters. I consider it good practice in object oriented programming to favor composition over inheritance. https://en.wikipedia.org/wiki/Composition_over_inheritance

Btw. I really like this talk 😁
https://learn.microsoft.com/en-us/shows/goingnative-2013/inheritance-base-class-of-evil (careful, it is C++)

Copy link
Contributor Author

@jduerholt jduerholt Mar 20, 2024

Choose a reason for hiding this comment

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

Hmm, I prefer the inheritance :D

But I will change it and add it as attribute to every class.

Best,

Johannes

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I prefer the inheritance :D

I know 😉

@jduerholt jduerholt merged commit 25112bf into main Mar 20, 2024
10 checks passed
@jduerholt jduerholt deleted the feature/batch_limit branch March 20, 2024 15:46
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