What does Likelihood-Ratio Screening of Luxury Goods conclude, in numbers, about “Double Counting: How Correlated Features Make Naive Bayes Overconfident”?

Answer: Chapter 2 is the core: with illustrative parameters, items the naive posterior scores above 0.99, at an average of 0.996, are non-conforming in a share of only 0.756; the inflation grows with within-class correlation and reaches 2.28 at a correlation of 0.6; yet the ranking does not suffer, and the damage is concentrated at boundaries far from the prior.

Scope of the numbers: Brands are named only generically, the parameters are illustrative, all calculations are generated by the book's programs, and the book is not individual business advice. Chapter 3 gives the effective number of independent features (four features are worth only 2.007 under the illustrative matrix) and a one-number slope of 0.571.

中文版

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.756, 0.99, 0.996

rho = 0.5, 40000 items, prior P(N) = 0.10
P(N) binnaive: nmeanobs N |exact: nmeanobs N
0.00-0.01196130.0020.015 |86940.0050.004
0.01-0.0564330.0250.055 |142290.0260.026
0.05-0.2050460.1060.105 |110700.1030.106
0.20-0.5034160.3290.173 |43290.3140.323
0.50-0.8023120.6500.285 |13330.6330.614
0.80-0.9516130.8830.395 |3130.8670.856
0.95-0.998710.9740.557 |290.9660.966
0.99-1.006960.9960.756 |30.9931.000
naive: Brier 0.0947log loss 0.3396share beyond 0.01/0.99 0.508
exact: Brier 0.0671log loss 0.2298share beyond 0.01/0.99 0.217
Show the full program
# Chapter 2. p21: naive Bayes counts correlated evidence twice. Four
# feature scores with an equal within-class correlation rho = 0.5 (a
# shared factor such as wear, age, lighting or the same operator), the
# same separations d as p12, prior P(N) = 0.10, 40,000 simulated items
# (fixed seed). Reliability table: predicted P(N) against the observed
# share of N, for the naive posterior and for the exact posterior that
# uses the correlation. All parameters are illustrative.
import math
import random

D = [1.2, 1.0, 1.5, 0.9]
RHO = 0.5
PRIOR_N = 0.10
NSIM = 40000
EDGES = [0.0, 0.01, 0.05, 0.2, 0.5, 0.8, 0.95, 0.99, 1.0000001]


def rinv_equi(n, rho):
    # 等相关矩阵的逆:(I - c J) / (1 - rho),c = rho / (1 + (n - 1) rho)
    c = rho / (1.0 + (n - 1) * rho)
    return [[((1.0 if i == j else 0.0) - c) / (1.0 - rho)
             for j in range(n)] for i in range(n)]


def matvec(a, x):
    return [math.fsum(r * v for r, v in zip(row, x)) for row in a]


def dot(x, y):
    return math.fsum(a * b for a, b in zip(x, y))


RI = rinv_equi(4, RHO)
W = matvec(RI, D)            # exact weights R^-1 d
C0 = dot(D, W) / 2.0
N0 = dot(D, D) / 2.0


def sigmoid(w, prior):
    o = math.log(prior / (1.0 - prior)) + w
    if o > 0:
        return 1.0 / (1.0 + math.exp(-o))
    e = math.exp(o)
    return e / (1.0 + e)


rng = random.Random(20261113)
rows = []
for _ in range(NSIM):
    y = 1 if rng.random() < PRIOR_N else 0
    f = rng.gauss(0.0, 1.0)
    z = [y * d + math.sqrt(RHO) * f + math.sqrt(1.0 - RHO)
         * rng.gauss(0.0, 1.0) for d in D]
    naive = dot(D, z) - N0
    exact = dot(W, z) - C0
    rows.append((y, sigmoid(naive, PRIOR_N), sigmoid(exact, PRIOR_N)))


def table(k):
    out = []
    for lo, hi in zip(EDGES[:-1], EDGES[1:]):
        sel = [r for r in rows if lo <= r[k] < hi]
        if sel:
            out.append((len(sel), math.fsum(r[k] for r in sel) / len(sel),
                        len([r for r in sel if r[0] == 1]) / len(sel)))
        else:
            out.append((0, 0.0, 0.0))
    return out


tn, te = table(1), table(2)
print("rho = %.1f, %d items, prior P(N) = %.2f" % (RHO, NSIM, PRIOR_N))
print("P(N) bin        naive: n   mean   obs N |  exact: n   mean   obs N")
for (lo, hi), a, b in zip(zip(EDGES[:-1], EDGES[1:]), tn, te):
    lab = "%.2f-%.2f" % (lo, min(hi, 1.0))
    print("%-12s %9d %6.3f %7.3f | %8d %6.3f %7.3f"
          % (lab, a[0], a[1], a[2], b[0], b[1], b[2]))
for k, name in ((1, "naive"), (2, "exact")):
    br = math.fsum((r[k] - r[0]) ** 2 for r in rows) / NSIM
    ll = -math.fsum(math.log(max(r[k] if r[0] else 1.0 - r[k], 1e-300))
                    for r in rows) / NSIM
    ext = len([r for r in rows if r[k] < 0.01 or r[k] > 0.99]) / NSIM
    print("%s: Brier %.4f  log loss %.4f  share beyond 0.01/0.99 %.3f"
          % (name, br, ll, ext))

Single source and citation

Fan, Y. (2026). Multi-Feature Likelihood-Ratio Screening of Pre-Owned Luxury Goods: Fusing Stitch Pitch, Hardware Spectra and Leather Grain, and the Bayesian Boundary between Lab Referral and Instant Purchase (Version 1.0.0), Chapter 2: Double Counting: How Correlated Features Make Naive Bayes Overconfident. 5D Library. DOI pending

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

BibTeX
@book{fan2026281,
  author    = {Fan, Yafu},
  title     = {Multi-Feature Likelihood-Ratio Screening of Pre-Owned Luxury Goods: Fusing Stitch Pitch, Hardware Spectra and Leather Grain, and the Bayesian Boundary between Lab Referral and Instant Purchase},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

Other chapter answers in this book