pymc-labs / pymc-marketing

Bayesian marketing toolbox in PyMC. Media Mix (MMM), customer lifetime value (CLV), buy-till-you-die (BTYD) models and more.
https://www.pymc-marketing.io/
Apache License 2.0
663 stars 183 forks source link

remove spend scaling step from budget optimizer #1070

Open juanitorduz opened 9 hours ago

juanitorduz commented 9 hours ago

When looking into https://github.com/pymc-labs/pymc-marketing/pull/1044 I encountered the following issue: The budget to allocate in the example is of the order of ~ 1e6 and I was getting an uniform split

pd.Series(mmm.optimal_allocation_dict)

Direct Mail       1.972773e+06
Insert            1.972773e+06
Newspaper         1.972773e+06
Online Display    1.972773e+06
Radio             1.972773e+06
Social Media      1.972773e+06
TV                1.972773e+06
dtype: float64

Nevertheless the plot

fig, ax = mmm.plot_budget_allocation(samples=response, figsize=(12, 8))
fig.suptitle("Response vs spent per channel");

showed

image

which was values of the order ~ 1e12.

I talked with @carlosagostini and notice that with the latest changes we do not need to scale the spends.


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

review-notebook-app[bot] commented 9 hours ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

juanitorduz commented 9 hours ago

In https://github.com/pymc-labs/pymc-marketing/pull/1070/commits/bc78e643b442f10650323877ffd6a002641874e1 I re-ran the notebook. The results look as expected right?

juanitorduz commented 8 hours ago

BTW: I changed the colours so that they can be synced with the user palettes (that is why we are using the "C0" and "C1") syntax

codecov[bot] commented 8 hours ago

Codecov Report

Attention: Patch coverage is 0% with 7 lines in your changes missing coverage. Please review.

Project coverage is 95.88%. Comparing base (d05c2d8) to head (bc78e64). Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pymc_marketing/mmm/mmm.py 0.00% 7 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1070 +/- ## ========================================== + Coverage 95.85% 95.88% +0.02% ========================================== Files 39 39 Lines 3934 3933 -1 ========================================== Hits 3771 3771 + Misses 163 162 -1 ``` | [Flag](https://app.codecov.io/gh/pymc-labs/pymc-marketing/pull/1070/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pymc-labs) | Coverage Δ | | |---|---|---| | [](https://app.codecov.io/gh/pymc-labs/pymc-marketing/pull/1070/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pymc-labs) | `95.88% <0.00%> (+0.02%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pymc-labs#carryforward-flags-in-the-pull-request-comment) to find out more.

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