Response curve Coefficient's I have them, Want to apply the Budget Optimization Api to perform Scenario Planning

I have exiting Response curve for each Media channel. I want to know if I can use the budget Optimizer class to just use those response curve coefficients along with our objective function constraints like total budget and channel level constraints to train some Scenarios? I am currently only able to see that we can only optimize if we have modeled our MMM through PyMc. If there is a possibility, would love to explore. Any help from @RavinKumar @twiecki would be great.

1 Like

Hey @Abhimanyu_Agarwala,

I’m not quite sure what you mean by “train some scenarios.” If you could give me a bit more context, I might be able to help you better.

That being said, you can still use the budget allocator functions even if your model hasn’t been trained. Here’s an example of how to do it:

First, you’ll need to import the necessary libraries:

from pymc_marketing.mmm.budget_optimizer import budget_allocator
from pymc_marketing.mmm.utils import (

Once you have the libraries in place, you can use the information from your variables X and Y to determine the parameters that best fit your data points:

estimate_menten_parameters(x=df.X.to_numpy(), y=df.y.to_numpy())
estimate_sigmoid_parameters(x=df.X.to_numpy(), y=df.y.to_numpy())

Once you have the dictionary with the parameters, you can run the allocator function:

    method: "michaelis-menten",
    total_budget: 300000,
    channels: ["x1","x2"],
    parameters: estimate_menten_parameters,
    budget_ranges: {"x1": [lower_limit, upper_limit]},

By doing this, you can take advantage of the allocation function without training a model. However, keep in mind that the precision of the function is not guaranteed because it depends on how well your raw data is structured and how evident the DMR relation is.

Also, remember that you’ll lose the confidence intervals because the posterior is not being generated. Essentially, the function allocates without the uncertainty derived only from the model training, so here your output is more point-estimated than probabilistic.

1 Like

By the way, better create new questions on our GitHub. Link here:
pymc-labs/pymc-marketing · Discussions · GitHub

1 Like