What does Zero-Touch Sites, Payment Anti-Fraud and Cashflow Queues conclude, in numbers, about “Allocating Traffic, Promoting Domains and Holding Cash”?

Answer: Chapter 6 allocates traffic by Thompson sampling (470.0 conversions short of the ideal), gives a posterior stopping rule for promoting a site to its own domain, and shows that a three-month halving of orders needs a cash reserve of 90,000.

Scope of the numbers: Marked boxes separate evidence, 16 runnable Python programs, historical sources and hypotheses.

中文版

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: 470.0

   ideal (best site only): 9905.2 conversions
   policy     conversions   regret   share to top 3
   uniform         3473.4   6431.9            0.100
   thompson        9435.2    470.0            0.911
Reading: Thompson sampling moves most paid traffic to the
few sites that convert best and recovers most of the gap
to the ideal; uniform splitting wastes it on sites whose low
rate was obvious within days.
Show the full program
# Chapter 6. [p11] Thompson sampling of paid traffic across 30 sites.
# Thirty sites on the shared kernel convert visitors with unknown rates
# p_i drawn once from Beta(2, 98) (mean 2%). A daily budget of 3,000
# paid visitors is split across them for 60 days. UNIFORM gives each
# site 100 a day; THOMPSON (in daily batches) draws 200 samples from
# every site's Beta(1 + conversions, 1 + misses) posterior and gives
# each site the share of draws in which it came out best.
# 50 replications with fixed seeds. Reported: conversions per run,
# regret against always using the best site, and the share of traffic
# that went to the three best sites.
import random

SITES, DAILY, DAYS, REPS, DRAWS = 30, 3000, 60, 50, 200

def run(rng, rates, policy):
    conv = [0] * SITES
    miss = [0] * SITES
    sent = [0] * SITES
    for _ in range(DAYS):
        if policy == "uniform":
            alloc = [DAILY // SITES] * SITES
        else:
            wins = [0] * SITES
            for _ in range(DRAWS):
                d = [rng.betavariate(1 + conv[k], 1 + miss[k])
                     for k in range(SITES)]
                wins[d.index(max(d))] += 1
            alloc = [DAILY * w // DRAWS for w in wins]
        for i, n in enumerate(alloc):
            c = sum(rng.random() < rates[i] for _ in range(n))
            sent[i] += n
            conv[i] += c
            miss[i] += n - c
    top = sorted(range(SITES), key=lambda k: -rates[k])[:3]
    return sum(conv), sum(sent[k] for k in top) / sum(sent)

if __name__ == "__main__":
    out = {"uniform": [], "thompson": []}
    best = []
    for r in range(REPS):
        rng = random.Random(75011 + r)
        rates = [rng.betavariate(2, 98) for _ in range(SITES)]
        best.append(max(rates) * DAILY * DAYS)
        for pol in out:
            out[pol].append(run(rng, rates, pol))
    ideal = sum(best) / REPS
    print("   ideal (best site only): {:.1f} conversions".format(ideal))
    print("   policy     conversions   regret   share to top 3")
    for pol, res in out.items():
        c = sum(x for x, _ in res) / REPS
        s = sum(y for _, y in res) / REPS
        print("   {:9s} {:12.1f} {:8.1f} {:16.3f}".format(
            pol, c, ideal - c, s))
    print("\nReading: Thompson sampling moves most paid traffic to the")
    print("few sites that convert best and recovers most of the gap")
    print("to the ideal; uniform splitting wastes it on sites whose low")
    print("rate was obvious within days.")

Single source and citation

Fan, Y. (2026). Zero-Touch Multi-Site Fault Tolerance, Payment Anti-Fraud State Machines and Passive Cashflow Queuing (Version 1.0.0), Chapter 6: Allocating Traffic, Promoting Domains and Holding Cash. 5D Library. https://doi.org/10.5281/zenodo.24090201

DOI: 10.5281/zenodo.24090201 · Read the monograph · 5DL-B-075 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026075,
  author    = {Fan, Yafu},
  title     = {Zero-Touch Multi-Site Fault Tolerance, Payment Anti-Fraud State Machines and Passive Cashflow Queuing},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  doi       = {10.5281/zenodo.24090201},
  url       = {https://doi.org/10.5281/zenodo.24090201}
}

Other chapter answers in this book