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

Budget optimizer refactor #1357

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ricardoV94
Copy link
Contributor

@ricardoV94 ricardoV94 commented Jan 8, 2025

This PR refactors the budget optimizer to extract the response graph from the MMM model directly. The users don't have to pass the arguments needed to rebuild the response function, which simplifies things quite a lot and makes the optimizer able to handle arbitrarily complex models [citation needed]

Breaking changes:

  1. Budget optimizer API totally changed. Only need to specify hmm_model, budget, and num_periods.
  2. No more automatic summation of the response variable, and batch dims of chain/sample are not raveled (unless the idata already stacked them), so objective functions and constraints may need to be rewritten.

TODO:

  • Tests of the BudgetOptimizer will need to be updated to have a hmm_model
  • Update NBs (?)
  • Update docs

Closes #1331


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

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 docs Improvements or additions to documentation CLV MMM tests mlflow labels Jan 8, 2025
@ricardoV94 ricardoV94 force-pushed the budget_optimizer_refactor branch from 0196b3a to 6c946f2 Compare January 8, 2025 18:33
@ricardoV94 ricardoV94 force-pushed the budget_optimizer_refactor branch 2 times, most recently from 3a348d2 to 10b0783 Compare January 8, 2025 18:35
Copy link

codecov bot commented Jan 8, 2025

Codecov Report

Attention: Patch coverage is 19.51220% with 33 lines in your changes missing coverage. Please review.

Project coverage is 55.53%. Comparing base (7dfa955) to head (36985c4).

Files with missing lines Patch % Lines
pymc_marketing/mmm/budget_optimizer.py 20.51% 31 Missing ⚠️
pymc_marketing/mmm/mmm.py 0.00% 2 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (7dfa955) and HEAD (36985c4). Click for more details.

HEAD has 4 uploads less than BASE
Flag BASE (7dfa955) HEAD (36985c4)
11 7
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1357       +/-   ##
===========================================
- Coverage   95.31%   55.53%   -39.79%     
===========================================
  Files          47       47               
  Lines        4912     4921        +9     
===========================================
- Hits         4682     2733     -1949     
- Misses        230     2188     +1958     

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

@juanitorduz
Copy link
Collaborator

juanitorduz commented Jan 8, 2025

yay! 🚀 Let me know if you need any support!

@cetagostini cetagostini mentioned this pull request Jan 8, 2025
14 tasks
@ricardoV94 ricardoV94 force-pushed the budget_optimizer_refactor branch from 10b0783 to 36985c4 Compare January 9, 2025 19:28
@ColtAllen
Copy link
Collaborator

Why does this have a CLV label?

@wd60622
Copy link
Contributor

wd60622 commented Jan 12, 2025

Why does this have a CLV label?

Seems like from file change bot. Then the force push made any clv files have no changes. I removed the clv label

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.

Making optimizer pymc model agnostic
4 participants