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

Question about constraint modelling #546

Open
Christopher-Wang opened this issue Feb 15, 2025 · 1 comment
Open

Question about constraint modelling #546

Christopher-Wang opened this issue Feb 15, 2025 · 1 comment

Comments

@Christopher-Wang
Copy link

Sorry if this is an obvious question, however I was reviewing the code for the constraint algorithm and stumbled across this line. I was wondering about the logic behind checking the lowerbound for the upper constraint. Why is this not checking the upper bound instead?

norm(loc=y_mean, scale=y_std).cdf(self._ub[0]) if self._lb[0] != np.inf else np.array([1])

@till-m
Copy link
Member

till-m commented Feb 17, 2025

Hi @Christopher-Wang,

first of all, great thing that you're checking the code!

You're completely right, this should be checking the upper constraint (frankly, quite an embarrassing thing to mess up on my part). The good news is that this just makes the code slightly less efficient by making an unnecessary call to .cdf, but doesn't break anything -- probably also why no one noticed it before. However, given that .cdf is about 1000x slower than calling np.array([1]) this should definitely be corrected.

Would you be interested in making a PR to fix this? :)

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

No branches or pull requests

2 participants