Sub topic 3
Choosing Content with Segments
Assume you understand campaigns, conversion rates, tabular data, and basic Python. The segment tells you who a customer is likely to be. Decisioning chooses what to show that customer.
Rules, next best action, and bandits
A rule is a fixed condition such as “show a renewal reminder to customers whose subscription ends within 14 days.” Rules are transparent and easy to audit, but they can become difficult to maintain.
A next-best-action system ranks eligible actions using context, such as segment, channel, recent activity, and business constraints. A bandit adapts this choice from feedback. It usually selects the variant with the best observed result, while occasionally exploring another variant.
import random
stats = {
"discount_banner": {"sends": 200, "clicks": 18},
"new_arrivals": {"sends": 180, "clicks": 25},
}
def choose_variant(stats, epsilon=0.1):
if random.random() < epsilon:
return random.choice(list(stats))
return max(
stats,
key=lambda name: stats[name]["clicks"] / max(stats[name]["sends"], 1),
)
print(choose_variant(stats))Testing and measuring lift
Use an A/B test when you want a controlled comparison between variants. Use a holdout when you need to compare personalisation against no personalisation. Randomly assign eligible customers and keep the holdout unchanged.
Incremental lift is the outcome rate for the treatment group minus the outcome rate for the holdout group. For example, a 6% conversion rate versus 4% gives 2 percentage points of lift. Track revenue, unsubscribes, and complaints as well as clicks.
Variants, freshness, and governance
Generative AI can create subject-line or copy variants from approved modules. Keep brand rules, prohibited claims, and human review outside the model. Log the prompt, output, approval, and version.
Refresh segments on a schedule that matches the behaviour being measured. Monitor feature distributions and segment sizes for drift, meaning that current data no longer resembles the training or baseline data. Activate only consented customers, and remove stale memberships.
Check whether targeting uses sensitive or proxy attributes. Limit frequency, explain relevant recommendations, and offer a non-personalised path. Personalisation should improve usefulness without making people feel watched.
Exercise
Why is a holdout needed when a personalised campaign has a higher conversion rate?
Show answer
The holdout estimates what would have happened without personalisation, allowing you to measure incremental lift rather than correlation.