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

batch constraints for DoE and __call__ for interpointEqualityConstraint #322

Merged

Conversation

Osburg
Copy link
Collaborator

@Osburg Osburg commented Dec 16, 2023

This PR adds a call method for batch constraints as discussed in #313 and adds support for batch constraints / InterpointEqualityConstraint in DoE as discussed in #310. Closes #310

@Osburg Osburg changed the title __call__ for interpointEqualityConstraint batch constraints for DoE and __call__ for interpointEqualityConstraint Dec 17, 2023
Copy link
Contributor

@jduerholt jduerholt left a comment

Choose a reason for hiding this comment

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

Looks good to me, what do you think, should we add another test in test_design.py in which we actually test that the DoE module is able to create such designs?

],
)
def test_constraints_call(constraints, num_candidates):
candidates = inputs.sample(num_candidates, SamplingMethodEnum.UNIFORM)
returned = constraints(candidates)
assert returned.shape == (num_candidates, len(constraints))

num_rows = 0
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we anywhere testing that the call method returns the correct values? We need to urgently refactor our tests :D

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

At least I haven't found them :D But added one testing if the design generation works with batch constraints.

@Osburg
Copy link
Collaborator Author

Osburg commented Dec 18, 2023

Weird that the test tests/bofire/strategies/test_base.py::test_base_fit[domain2-data2] is failing ... Is there maybe some randomness in it that could've caused the fail (I think I do not have the permission to rerun workflows, so I can't test by myself)?

@jduerholt
Copy link
Contributor

Just ignore it, this is due to randomness ...

Copy link
Contributor

@jduerholt jduerholt left a comment

Choose a reason for hiding this comment

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

Looks good to me. @KappatC ok for you to merge?

x1 = np.round(result["x1"].values, 6)

assert 0 in x1 and 1 in x1
for i in range(10):
Copy link
Contributor

Choose a reason for hiding this comment

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

you could just call domain.validate_candidates(result, only_inputs=True) in the test. This is also doing the check.

@KappatC
Copy link
Collaborator

KappatC commented Dec 19, 2023

Looks good to me. @KappatC ok for you to merge?

yes, please go ahead

@jduerholt jduerholt merged commit 7889ad9 into experimental-design:main Dec 19, 2023
9 of 10 checks passed
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.

Batch constraint for DoE
3 participants