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

Feature/add desirability function in range #504

Merged
merged 9 commits into from
Jan 29, 2025

Conversation

LukasHebing
Copy link
Contributor

@LukasHebing LukasHebing commented Jan 28, 2025

This PR adds the desirability function InRangeDesirability

This objective is $1.$ inside a specified range, and $0.$ outside this range, defined by the bounds of the objective data-model.

This is used in our app by the users to handle quality constraints.

The data-model is added in bofire/data_models/objectives/desirabilities.py

An example is given within the desirability notebook tutorials/advanced_examples/desirability_objectives.ipynb

@LukasHebing LukasHebing requested a review from jduerholt January 28, 2025 18:07
@LukasHebing LukasHebing marked this pull request as draft January 28, 2025 18:07
@LukasHebing
Copy link
Contributor Author

We have a linting error pointing out that get_objective_callable is too complex, which I totally agree on. It seems, that we now reached the limit of allowed if-statements, as the number of objectives increased.

I would like to restructure the definition of the torch callables (preferrably put them into the data-models?), but that would be a bit much for this PR.

@jduerholt: Can we somehow increase the level of allowed complexity for the linting?

@LukasHebing LukasHebing marked this pull request as ready for review January 28, 2025 18:42
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. The complexity threshold can be adjusted here. As quick fix you can increase it to 19 (

max-complexity = 18
)

We should refactor this part in a seperate PR, but I would not include it directly in the data models because than we would have torch also as part of the minimal installation, so you would need torch for running the data models.

Just increase the thresshold and merge it in. Thanks!

@LukasHebing
Copy link
Contributor Author

Looks good to me. The complexity threshold can be adjusted here. As quick fix you can increase it to 19 (

max-complexity = 18

)
We should refactor this part in a seperate PR, but I would not include it directly in the data models because than we would have torch also as part of the minimal installation, so you would need torch for running the data models.

Just increase the thresshold and merge it in. Thanks!

I increased the complexity as suggested. Thanks @jduerholt :)

@jduerholt jduerholt merged commit 9a5f76c into main Jan 29, 2025
8 of 10 checks passed
@jduerholt jduerholt deleted the feature/add_desirability_function_in_range branch January 29, 2025 12:17
@CompRhys CompRhys mentioned this pull request Jan 29, 2025
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