-
Notifications
You must be signed in to change notification settings - Fork 220
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
Custom optimizer constraints #1358
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about defining the types a bit more
class Constraint:
key: str
constraint_type: Literal["eq", ...]
sym_fun: Callable[[], pt.TensorVariable]
sym_jac: Callable[[], pt.TensorVariable]
# Then can use like
constraints: list[Constraint] = [...]
Otherwise, functions like compile_constraints_for_scipy
are quite hard to read
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sym_jac won't stay if it's still there btw
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1358 +/- ##
===========================================
- Coverage 95.31% 54.96% -40.36%
===========================================
Files 47 48 +1
Lines 4912 5007 +95
===========================================
- Hits 4682 2752 -1930
- Misses 230 2255 +2025 ☔ View full report in Codecov by Sentry. |
Where there any closing issues for this? |
5e5c73a
to
02ce740
Compare
aeeb060
to
17c86f1
Compare
The changes are so big that we probably will just skip #1357 to keep our sanity |
Description
Allowing optimizer to use custom constraints around any intermediate variable (e.g: Response, Specific channel contributions or budgets).
Build on top of #1357 by @ricardoV94
Related Issue
Checklist
Modules affected
Type of change
📚 Documentation preview 📚: https://pymc-marketing--1358.org.readthedocs.build/en/1358/