CommencerCommencer gratuitement

How bad can it be?

You have concluded that with 98% probability, clothes ads have a higher click-through ratio than sneakers ads. This suggests rolling out the clothes campaign to a larger audience. However, there is a 2% risk that it's the sneakers ads that are actually better. If that's the case, how many clicks do we lose if we roll out the clothes campaign?

The answer to this is the expected loss: the average posterior difference between the two click-through ratios given that sneakers ads do better. To calculate it, you only need to take the entries in the posterior difference where the sneakers click-through rate is higher and compute their average.

The posterior difference between the click rates, diff, is available in your workspace. Let's find out how much is at risk!

Cet exercice fait partie du cours

Bayesian Data Analysis in Python

Afficher le cours

Instructions

  • Slice diff to take only cases where it is negative (corresponding to sneakers click rate being higher) and assign the result to loss.
  • Calculate the average loss, assign it to expected_loss and print it.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Slice diff to take only cases where it is negative
loss = ____

# Compute and print expected loss
expected_loss = ____
print(____)
Modifier et exécuter le code