What does Zero-Ticket Interfaces and Self-Service State Machines conclude, in numbers, about “Root-Cause Clustering of Tickets: What a Month of After-Sale Messages Is Made Of”?

Answer: Chapter 1 clusters tickets with a home-made tokenizer, Jaccard similarity and single-link merging, reaching purity 0.888 at threshold 0.30, and shows that clusters become root causes only when a person names them.

Scope of the numbers: Parameters are illustrative and all calculations come from the book's programs; the book is general business analysis, not individual or legal advice. Marked boxes separate published evidence, runnable Python calculations (22 programs), classical sources and the author's 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: 0.30, 0.888

tickets 366  distinct token sets 66
thresh clusters singletons purity mixed largest
 0.15        7          0  0.623     2     232
 0.30       19          0  0.888     3      63
 0.50       26          0  0.967     1      39
top clusters at 0.30 (size, majority class, a member):
   63  not_received  'report not received email'
   58  progress      'where is my order now'
   36  not_received  'hello charged twice payment'
   28  not_received  'thanks paid but nothing in inbox'
   27  progress      'hi when will parcel'
   26  wrong_input   'hi birth data mistake correct'
Show the full program
# Chapter 1. p12: Jaccard single-link clustering of the p11 month
# Own tokenizer, Jaccard similarity on word sets and single-link
# clustering by union-find at three thresholds. Purity is measured
# against the hidden root-cause class that the generator knows.
import random
import re
from collections import Counter

CLASSES = [
    ("not_received", 0.22, ["report not received email",
                            "no email arrived after payment",
                            "paid but nothing in inbox"]),
    ("wrong_input", 0.15, ["wrong birth time entered",
                           "typed wrong date need fix",
                           "birth data mistake correct"]),
    ("progress", 0.20, ["where is my order now",
                        "order status update",
                        "when will parcel arrive"]),
    ("repeat_chase", 0.12, ["asked yesterday no reply where order",
                            "second message still waiting",
                            "again asking status still nothing"]),
    ("link_expired", 0.08, ["download link expired",
                            "link not working cannot download",
                            "book link dead"]),
    ("refund", 0.06, ["want refund", "refund request order cancel",
                      "money back cancel order"]),
    ("content_q", 0.07, ["question about report meaning",
                         "what does section mean",
                         "explain chapter in report"]),
    ("payment", 0.05, ["charged twice payment",
                       "payment failed but money taken",
                       "card declined cannot pay"]),
    ("other", 0.05, ["change shipping address",
                     "invoice needed company",
                     "partnership question"]),
]
FILLER = ["hi", "please", "help", "urgent", "thanks", "today",
          "hello", "asap", "pls"]
STOP = set(FILLER) | {"is", "my", "in", "but", "the", "a", "will",
                      "does", "what", "about", "after", "no", "not"}


def month(rng, days=30, orders=100, p_ticket=0.12):
    out = []
    weights = [w for _, w, _ in CLASSES]
    for day in range(days):
        for _ in range(orders):
            if rng.random() >= p_ticket:
                continue
            k = rng.choices(range(len(CLASSES)), weights)[0]
            words = rng.choice(CLASSES[k][2]).split()
            if len(words) > 2 and rng.random() < 0.15:
                del words[rng.randrange(len(words))]
            if rng.random() < 0.5:
                words.insert(0, rng.choice(FILLER))
            out.append((day, CLASSES[k][0], " ".join(words)))
    return out


def tokens(text):
    return frozenset(w for w in re.findall(r"[a-z]+", text.lower())
                     if w not in STOP)


def jaccard(a, b):
    if not a and not b:
        return 1.0
    return len(a & b) / len(a | b)


def single_link(sets, t):
    parent = list(range(len(sets)))

    def find(i):
        while parent[i] != i:
            parent[i] = parent[parent[i]]
            i = parent[i]
        return i
    for i in range(len(sets)):
        for j in range(i + 1, len(sets)):
            if jaccard(sets[i], sets[j]) >= t:
                ri, rj = find(i), find(j)
                if ri != rj:
                    parent[max(ri, rj)] = min(ri, rj)
    return [find(i) for i in range(len(sets))]


tickets = month(random.Random(40101))
sets = [tokens(t[2]) for t in tickets]
labels = [t[1] for t in tickets]
n = len(tickets)
print("tickets {}  distinct token sets {}".format(n, len(set(sets))))
print("thresh clusters singletons purity mixed largest")
for t in (0.15, 0.3, 0.5):
    root = single_link(sets, t)
    groups = {}
    for i, r in enumerate(root):
        groups.setdefault(r, []).append(labels[i])
    pure = 0
    mixed = 0
    single = 0
    for g in groups.values():
        top = Counter(g).most_common(1)[0][1]
        pure += top
        if top < len(g):
            mixed += 1
        if len(g) == 1:
            single += 1
    big = max(len(g) for g in groups.values())
    print("{:>5.2f} {:>8} {:>10} {:>6.3f} {:>5} {:>7}".format(
        t, len(groups), single, pure / n, mixed, big))
root = single_link(sets, 0.3)
groups = {}
for i, r in enumerate(root):
    groups.setdefault(r, []).append(i)
order = sorted(groups.values(), key=lambda g: (-len(g), g[0]))
print("top clusters at 0.30 (size, majority class, a member):")
for g in order[:6]:
    maj = Counter(labels[i] for i in g).most_common(1)[0][0]
    print("  {:>3}  {:<13} '{}'".format(len(g), maj, tickets[g[0]][2]))

Single source and citation

Fan, Y. (2026). Zero-Ticket Self-Repairing Order Interfaces, Self-Service Correction State Machines and Pre-Emptive Support Elimination (Version 1.0.0), Chapter 1: Root-Cause Clustering of Tickets: What a Month of After-Sale Messages Is Made Of. 5D Library. DOI pending

DOI pending · monograph page goes live after publication · 5DL-B-401 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026401,
  author    = {Fan, Yafu},
  title     = {Zero-Ticket Self-Repairing Order Interfaces, Self-Service Correction State Machines and Pre-Emptive Support Elimination},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

Other chapter answers in this book