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!
This exercise is part of the course
Bayesian Data Analysis in Python
Exercise instructions
- Slice
diff
to take only cases where it is negative (corresponding to sneakers click rate being higher) and assign the result toloss
. - Calculate the average
loss
, assign it toexpected_loss
and print it.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Slice diff to take only cases where it is negative
loss = ____
# Compute and print expected loss
expected_loss = ____
print(____)