Comments (10)
@entzyeung can you please share your code ? I too faced similar issue and I am able to resolve it.
from lightweight_mmm.
@entzyeung I can see only 2 problems i.e the way you defined prices and budget. I am using below code to find price and budget. Please try this and let me know if this fix your issue.
Note, here costs and media_data are unscaled values.
prices = costs / media_data.sum(axis=0)
budget = jnp.sum(jnp.dot(prices, media_data.mean(axis=0)))* n_time_periods
from lightweight_mmm.
@entzyeung The changes in price and budget i suggested earlier, was to sync your prices and budget with original data. I think the reason you might be getting same distribution can be the upper and lower bound percentages. Can you try changing that too ? May be something like upper bound 2 and lower bound 0.5.
from lightweight_mmm.
@entzyeung Its part of find_optimal_budgets function. By default both of them are 0.2
from lightweight_mmm.
Dear LMMM Team,
I want to express my sincere appreciation for the hard work you've dedicated to creating this remarkable model. It's truly impressive and has proven to be user-friendly and easy to install, unlike my previous attempt with the FB Robyn model, which I eventually abandoned due to its complexity. Discovering your model felt like a ray of sunshine after a cloudy day.
To cut to the chase, I've encountered a similar issue to that of @DongHarry-Kang. I've spent considerable time experimenting with various datasets and fine-tuning for two weeks. However, I consistently obtain similar results when calling the plot_pre_post_budget_allocation_comparison
function.
I've included some sample outputs below:
I've thoroughly examined data quality using check_data_quality()
, assessed variances with highlight_variances()
, reviewed spend fractions with highlight_low_spend_fractions()
, and analyzed variance inflation factors with highlight_high_vif_values()
. The datasets appear to be in good shape and suitable for analysis. I even trained the best model with parameters obtained from Gridsearches. However, when it comes to the critical aspect of budget allocation, it seems there may be an issue.
Regardless of how I adjust the budget and cost parameters, the model consistently produces the same outcome: maintaining the same channel ratios while suggesting a higher budget allocation.
Allow me to illustrate this with an example.
As you can see from the investigation, the model did suggest me different and higher budget while maintaining the same channel ratios. I am so confused that why the model not reallocating the budgets as the documentation said? and keep increasing our budget instead?
is there any params I missed? if not, is there any way to fix it?
Here is my syntax when calling the optimizatin function:
Run optimization with the parameters of choice.
solution, kpi_without_optim, previous_media_allocation = optimize_media.find_optimal_budgets(
n_time_periods= n_time_periods,
media_mix_model= mmm,
extra_features= extra_features_test[:n_time_periods],# it has been scaled.
budget= budget,
prices= prices,
media_scaler = media_scaler,
target_scaler = target_scaler,
)
Plot out pre post optimization budget allocation and predicted target variable comparison.
plot.plot_pre_post_budget_allocation_comparison(media_mix_model=mmm,
kpi_with_optim=solution['fun'],
kpi_without_optim=kpi_without_optim,
optimal_buget_allocation=optimal_buget_allocation,
previous_budget_allocation=previous_budget_allocation,
figure_size=(10,10))
Thank you in advance.
from lightweight_mmm.
@shubhamgupta568 thank you for dropping by, here is the link to the notebook.
please let me know why was that and which pieces of code should be corrected. Appreciated!
from lightweight_mmm.
Thank you @shubhamgupta568 for the solution, i am running the code again now. The first run gave me the same distribution, so i am running it again. WIll keep you posted. What caused the problem? is it the dtype of the media_data?
from lightweight_mmm.
Hello @shubhamgupta568 , I have tried many times, and have made sure both costs, and media_data are unscaled jnp array. Here are the results:
As you can see, the budget allocation percentages are the same, just the total budget is inflated a bit. I was thinking if it was the data type problem. But I have ensured they are unscaled jnp array. So i really have no clue what is happening here. Do you have any idea? I don't mind to exchange our notebooks if you want to.
from lightweight_mmm.
from lightweight_mmm.
Hello @shubhamgupta568 , here is my code:
solution, kpi_without_optim, previous_media_allocation = optimize_media.find_optimal_budgets(
n_time_periods= n_time_periods,
media_mix_model= mmm,
extra_features= extra_features_test[:n_time_periods],#### transformed, and the forecasted period [:n_time_periods]
budget= budget,
prices= prices,
media_scaler = media_scaler,
target_scaler = target_scaler,
seed= SEED,
bounds_upper_pct = 0.05,
bounds_lower_pct = 0.05
)
I tried multiple sets of upper and lower pct, all of them gave me the same percentage of distribution, but if i set the upper and lower smaller than 0.2, there would be a height differences between bars, while remaining the same pct. If i set the upper and lower bigger than 0.2, the height between bars would be exactly the same.
The graph below is bounds pct = 0.3 (upper bound 2 and lower bound 0.5 gives me exactly the same distributions, and same heights as the graph below too)
The graph below is bounds pct = 0.05
from lightweight_mmm.
Related Issues (20)
- How can I input future media_data_test for optimization in upcoming periods? HOT 1
- How can channel-wise optimized conversions be obtained?
- Extra features
- Addressing Heteroscedasticity
- Geo level attribution and response curves
- Question on tensorflow requirement
- Dtype object is not a valid JAX array type. Only arrays of numeric types are supported by JAX. HOT 5
- Same pre-optimization and post-optimization channel budget allocation ratios , but suggesting much higher budget instead of aligning the budget to the one i requested. HOT 10
- Paid Search bias - Nested model
- Divergences and n_eff
- Outliers and influential points
- budget allocator: How to set up lower bound and upper bound per channel?
- add got incompatible shapes for broadcasting: (95,), (90,). HOT 5
- TypeError: add got incompatible shapes for broadcasting: (58,), (54,). HOT 8
- Rendering of several plots not working! HOT 1
- Negative Values in Pre optimization predicted Target vs Post optimization predicted Target
- Budget Optimization
- RuntimeError: Cannot find valid initial parameters. Please check your model again.
- TypeError: where() got some positional-only arguments passed as keyword arguments: 'condition, x, y' HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lightweight_mmm.