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

Custom optimizer constraints #1358

Merged
merged 27 commits into from
Jan 20, 2025
Merged

Custom optimizer constraints #1358

merged 27 commits into from
Jan 20, 2025

Conversation

cetagostini
Copy link
Contributor

@cetagostini cetagostini commented Jan 8, 2025

Description

Allowing optimizer to use custom constraints around any intermediate variable (e.g: Response, Specific channel contributions or budgets).

It also allows optimizing a subset of budgets by passing a boolean opt_mask

Build on top of #1357 by @ricardoV94

Related Issue

Checklist

Modules affected

  • MMM
  • CLV
  • Customer Choice

Type of change

  • New feature / enhancement
  • Bug fix
  • Documentation
  • Maintenance
  • Other (please specify):

📚 Documentation preview 📚: https://pymc-marketing--1358.org.readthedocs.build/en/1358/

Copy link

codecov bot commented Jan 8, 2025

Codecov Report

Attention: Patch coverage is 84.40367% with 17 lines in your changes missing coverage. Please review.

Project coverage is 94.59%. Comparing base (8a0b076) to head (81a0eeb).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
pymc_marketing/mmm/budget_optimizer.py 83.33% 10 Missing ⚠️
pymc_marketing/mmm/mmm.py 40.00% 3 Missing ⚠️
pymc_marketing/mmm/constraints.py 93.75% 2 Missing ⚠️
pymc_marketing/mmm/utility.py 83.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1358      +/-   ##
==========================================
- Coverage   94.65%   94.59%   -0.06%     
==========================================
  Files          48       49       +1     
  Lines        5257     5329      +72     
==========================================
+ Hits         4976     5041      +65     
- Misses        281      288       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wd60622 wd60622 changed the title Custom constraints Custom optimizer constraints Jan 8, 2025
@wd60622
Copy link
Contributor

wd60622 commented Jan 8, 2025

Where there any closing issues for this?

@ricardoV94 ricardoV94 force-pushed the custom_constraints_refactor branch from 5e5c73a to 02ce740 Compare January 9, 2025 19:27
@ricardoV94 ricardoV94 force-pushed the custom_constraints_refactor branch from aeeb060 to 17c86f1 Compare January 13, 2025 17:10
@ricardoV94
Copy link
Contributor

ricardoV94 commented Jan 13, 2025

The changes are so big that we probably will just skip #1357 to keep our sanity
Edit: cross that

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@github-actions github-actions bot added the docs Improvements or additions to documentation label Jan 17, 2025
@cetagostini cetagostini marked this pull request as ready for review January 17, 2025 02:37
@cetagostini
Copy link
Contributor Author

I think everything is ready for review @wd60622 @ricardoV94 @juanitorduz

Need to run a few notebooks to create a new files for the model because I'm addressing #1387 here!

pymc_marketing/mmm/mmm.py Outdated Show resolved Hide resolved
pymc_marketing/mmm/mmm.py Outdated Show resolved Hide resolved
tests/mmm/test_budget_optimizer.py Show resolved Hide resolved
tests/mmm/test_budget_optimizer.py Outdated Show resolved Hide resolved
pymc_marketing/mmm/budget_optimizer.py Show resolved Hide resolved
pymc_marketing/mmm/budget_optimizer.py Outdated Show resolved Hide resolved
pymc_marketing/mmm/constraints.py Show resolved Hide resolved
pymc_marketing/mmm/constraints.py Outdated Show resolved Hide resolved
pymc_marketing/mmm/constraints.py Outdated Show resolved Hide resolved
pymc_marketing/mmm/budget_optimizer.py Outdated Show resolved Hide resolved
Copy link
Contributor

@wd60622 wd60622 left a comment

Choose a reason for hiding this comment

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

Just one comment. Not a blocker though

Looks awesome

@juanitorduz juanitorduz merged commit 2f6bc0a into main Jan 20, 2025
18 of 20 checks passed
@juanitorduz juanitorduz deleted the custom_constraints_refactor branch January 20, 2025 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation enhancement New feature or request MMM optimizer priority: high tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Define a total_channel_contributions deterministic in MMM models Making optimizer pymc model agnostic
4 participants