pymc-marketing icon indicating copy to clipboard operation
pymc-marketing copied to clipboard

Add optimization notebook

Open cluhmann opened this issue 1 year ago • 8 comments

Initial version of the optimization notebook. I have not yet added all the "bells and whistles" that are possible, because I want to get feedback on the core first. Then we can make it pretty.

One thing that I think can immediately be improved is to replace much of the manual contribution/ROAS calculation code with things like mmm.channel_contributions_forward_pass() etc. These helper functions didn't exist when the notebook was first created.

Also, I had planned on omitting all the MMM example notebook code, but realized I need to serialize the model, the inferenceData object, and the input data (and possibly more?). So I just kept the code but stripped it down to the essentials. Keeping all these cells also prevents "syncing" issues between this notebook and the MMM example notebook.

Todos:

  • [ ] Replace objective function code with pymc-marketing functionality as possible
  • [ ] Make objective function a compiled pytensor function to avoid eval()s
  • [ ] Add additional exploration of optimization results (e.g., risk attitudes, diversification penalty, etc.)

:books: Documentation preview :books:: https://pymc-marketing--358.org.readthedocs.build/en/358/

cluhmann avatar Aug 17 '23 23:08 cluhmann

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 94.58%. Comparing base (ac645c9) to head (3b5c92a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #358   +/-   ##
=======================================
  Coverage   94.58%   94.58%           
=======================================
  Files          33       33           
  Lines        3378     3378           
=======================================
  Hits         3195     3195           
  Misses        183      183           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Aug 18 '23 00:08 codecov[bot]

This seems stale. Shall we close and turn into smaller issues? Thoughts @cluhmann @juanitorduz

wd60622 avatar Jul 25 '24 17:07 wd60622

This notebook has many great ideas that I would like to explore further. Can we leave it open while I try to get some time? Maybe we can add a special label?

juanitorduz avatar Jul 25 '24 17:07 juanitorduz

Or actually, as it is a dev notebook, can we merge it into the dev folder (as the clv dev ones)?

juanitorduz avatar Jul 25 '24 17:07 juanitorduz

Happy to help hammer this into something (more) useful.

cluhmann avatar Jul 25 '24 17:07 cluhmann

How about merge in since it is dev notebook and then create an issue or two?

wd60622 avatar Jul 25 '24 17:07 wd60622

Fine with me.

cluhmann avatar Jul 25 '24 17:07 cluhmann