Skip to content

Commit

Permalink
Correcting typo and adding feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
cetagostini committed Oct 13, 2023
1 parent 9b8ee10 commit 2796df2
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions pymc_marketing/mmm/budget_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ def calculate_expected_contribution(
total_expected_contribution = 0.0
contributions = {}

for channel, channe_budget in budget.items():
for channel, channel_budget in budget.items():
if method == "michaelis-menten":
L, k = parameters[channel]
contributions[channel] = michaelis_menten(channe_budget, L, k)
contributions[channel] = michaelis_menten(channel_budget, L, k)

elif method == "sigmoid":
alpha, lam = parameters[channel]
contributions[channel] = extense_sigmoid(channe_budget, alpha, lam)
contributions[channel] = extense_sigmoid(channel_budget, alpha, lam)

else:
raise ValueError("`method` must be either 'michaelis-menten' or 'sigmoid'.")
Expand Down Expand Up @@ -164,7 +164,15 @@ def optimize_budget_distribution(

if budget_ranges is None:
budget_ranges = {
channel: (0, min(total_budget, parameters[channel][0]))
channel: (
0,
min(
total_budget,
9 * parameters[channel][1]
if method == "michaelis-menten"
else -np.log(0.1 / 1.9) / parameters[channel][1],
),
)
for channel in channels
}

Expand Down

0 comments on commit 2796df2

Please sign in to comment.