Skip to content

674 bug discrete variables in doe#742

Open
dlinzner-bcs wants to merge 3 commits intomainfrom
674-bug-discrete-variables-in-doe
Open

674 bug discrete variables in doe#742
dlinzner-bcs wants to merge 3 commits intomainfrom
674-bug-discrete-variables-in-doe

Conversation

@dlinzner-bcs
Copy link
Copy Markdown
Contributor

Motivation

(Write your motivation here.)

Have you read the Contributing Guidelines on pull requests?

(Write your answer here.)

Have you updated CHANGELOG.md?

(Write your answer here.)

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified that your changes work.)

Comment thread bofire/strategies/doe/utils.py Outdated
_inputs = list(inputs.get([ContinuousInput]))
_inputs = [
input for input in inputs.get([DiscreteInput]) if len(input.values) > 2
] + _inputs
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

now discrete are first thus test_formula_discrete_handled_like_continuous fails due to ordering. I updated it

) # formula casting for expansion of terms like (a+b)*(c+d)
for _input in inputs.get([DiscreteInput]):
for k in range(
2, 99
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can we add sth like len(_input.values)+1 instead of 99 which is arbitary?

Comment thread bofire/strategies/doe/utils.py Outdated
): # arbitrary upper bound on number of levels of discrete input
if (len(_input.values) <= k) and (_input.key + f" ** {k}" in formula.root):
warnings.warn(
f"Discrete input {_input.key} with {len(_input.values)} levels can not be represent term of order {k} or higher.",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

syntax error. I corrected this

custom_formula = "color + material + temperature + { pressure ** 2 } + color:material + color_intensity"
with pytest.warns(
UserWarning,
match="Discrete input pressure with 2 levels can not be represent term of order 2 or higher.",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

dito :)

2, 99
): # arbitrary upper bound on number of levels of discrete input
if (len(_input.values) <= k) and (_input.key + f" ** {k}" in formula.root):
warnings.warn(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

so now it gives a warning but continues. i guess that is fine. alternatively we could throw a value error I guess

Copy link
Copy Markdown
Collaborator

@KappatC KappatC left a comment

Choose a reason for hiding this comment

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

thank you Dominik. Looks good to me. Added a few comments and make some small changes to the files mostly because some tests were failing. Let me know if you are happy with these and if so we can merge

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.

[Bug]: Discrete variables in DoE not handled correct in cases, e.g. with 2 levels and quadratic terms

2 participants