What does Audience-Adaptive Interfaces conclude, in numbers, about “The Segmentation Engine: Observable Signals, Naive Bayes and a Cost Matrix for Misrouting”?
Answer: Chapter 6 builds a naive Bayes segmentation engine and prices its mistakes: inference alone loses 44.0 completions per thousand visits, a default with a visible one-tap switch 20.2, inference with the switch 14.2; a SHA-256 check enforces identical prices and terms across templates.
Scope of the numbers: Parameters are illustrative, all calculations come from the book's programs, and no real site is described. This is not legal advice and not personalised business advice.
Data table
The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 14.2, 20.2, 44.0
| expected lost completions per 1,000 visits | |
| A infer only | 44.0 |
| B default + switch | 20.2 |
| C infer + switch | 14.2 |
| D choice card | 31.2 |
| elder-preferring visitors under A: 83.6 per 1,000 |
Show the full program
# Chapter 6. p62: expected cost of misrouting under four policies.
# Reuses the p61 generator and classifier (same seed, same split).
# C[i][j] = assumed probability that a visitor who prefers template i
# abandons when shown template j (illustrative). Policies: A infer only;
# B default for all plus a visible one-tap switch; C infer plus the same
# switch; D a one-screen choice card. A mismatched visitor finds the
# switch with probability F (0.85 for elder, 0.90 otherwise, assumed)
# and then pays a switching cost 0.02; the card costs 0.03 per visit
# and is answered correctly with probability 0.95.
import math
import random
SEG = ["elder", "fashion", "property", "narrative", "default"]
PRIOR = [0.20, 0.30, 0.15, 0.15, 0.20]
SIG = ["zoom", "long_dwell", "backs2", "qr_entry", "deep_scroll",
"table_sort"]
LIK = [ # P(signal = 1 | segment), columns follow SEG
[0.60, 0.10, 0.15, 0.15, 0.15],
[0.50, 0.15, 0.45, 0.55, 0.25],
[0.45, 0.15, 0.25, 0.20, 0.25],
[0.55, 0.20, 0.25, 0.15, 0.20],
[0.25, 0.35, 0.40, 0.70, 0.30],
[0.05, 0.10, 0.60, 0.05, 0.15],
]
def simulate(rng, n):
out = []
for _ in range(n):
s = rng.choices(range(5), weights=PRIOR)[0]
x = tuple(int(rng.random() < LIK[j][s]) for j in range(6))
out.append((s, x))
return out
def train(data):
cnt = [0] * 5
on = [[0] * 5 for _ in range(6)]
for s, x in data:
cnt[s] += 1
for j in range(6):
on[j][s] += x[j]
pri = [(c + 1) / (len(data) + 5) for c in cnt]
lik = [[(on[j][s] + 1) / (cnt[s] + 2) for s in range(5)]
for j in range(6)]
return pri, lik
def predict(model, x):
pri, lik = model
best, arg = -1e9, 0
for s in range(5):
lp = math.log(pri[s]) + math.fsum(
math.log(lik[j][s] if x[j] else 1.0 - lik[j][s])
for j in range(6))
if lp > best:
best, arg = lp, s
return arg
rng = random.Random(20261120)
data = simulate(rng, 6000)
model = train(data[:3000])
conf = [[0] * 5 for _ in range(5)]
for s, x in data[3000:]:
conf[s][predict(model, x)] += 1
C = [
[0.00, 0.30, 0.20, 0.15, 0.12],
[0.06, 0.00, 0.08, 0.05, 0.04],
[0.08, 0.12, 0.00, 0.10, 0.05],
[0.06, 0.08, 0.10, 0.00, 0.05],
[0.04, 0.05, 0.04, 0.04, 0.00],
]
F = [0.85, 0.90, 0.90, 0.90, 0.90]
SW, ASK, RIGHT = 0.02, 0.03, 0.95
test = data[3000:]
cost = {"A infer only": [], "B default + switch": [],
"C infer + switch": [], "D choice card": []}
elder_a = []
for s, x in test:
j = predict(model, x)
a = C[s][j]
cost["A infer only"].append(a)
if s == 0:
elder_a.append(a)
miss_b = C[s][4]
b = 0.0 if s == 4 else F[s] * SW + (1 - F[s]) * miss_b
cost["B default + switch"].append(b)
c = 0.0 if j == s else F[s] * SW + (1 - F[s]) * a
cost["C infer + switch"].append(c)
d = ASK + (1 - RIGHT) * (F[s] * SW + (1 - F[s]) * miss_b)
cost["D choice card"].append(d)
print("expected lost completions per 1,000 visits")
for k, v in cost.items():
print(" {:<20} {:>6.1f}".format(k, 1000 * math.fsum(v) / len(v)))
print("elder-preferring visitors under A: {:.1f} per 1,000".format(
1000 * math.fsum(elder_a) / len(elder_a)))Single source and citation
Fan, Y. (2026). Demographic Cognitive Segmentation, Elder-to-Gen-Z Interface Divergence and Audience-Adaptive Conversion UX (Version 1.0.0), Chapter 6: The Segmentation Engine: Observable Signals, Naive Bayes and a Cost Matrix for Misrouting. 5D Library. DOI pending
DOI pending · monograph page goes live after publication · 5DL-B-363 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026363,
author = {Fan, Yafu},
title = {Demographic Cognitive Segmentation, Elder-to-Gen-Z Interface Divergence and Audience-Adaptive Conversion UX},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}Other chapter answers in this book
- Chapter 1 · Year of Birth Is Not an Interface Variable: the Variance of Cohort Labels and Measurable Capabilities
- Chapter 2 · Hick and Fitts: an Account of Operating Time for Folded Menus and Linear Paths
- Chapter 3 · The Exact Arithmetic of Contrast: sRGB Linearisation, Dark Themes and High-Contrast Themes
- Chapter 4 · The Checkout Friction Funnel: Field Counts, Scan-to-Fill and the Product of Abandonment Rates
- Chapter 5 · Assortment Size and the Probability of Buying: the Uncertain Inverted U
- Chapter 7 · Classical Sources: Teaching by Temperament in the Analects, Courtesy to Elders in the Book of Rites, and Aristotle on Young and Old Audiences
- Chapter 8 · Standard Operating Templates and Checker Specification: the Weekly Audience-Template Ledger, Pre-Registered Tests and Refutation Conditions