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) bin | naive: n | mean | obs N | | exact: n | mean | obs N |
| 0.00-0.01 | 19613 | 0.002 | 0.015 | | 8694 | 0.005 | 0.004 |
| 0.01-0.05 | 6433 | 0.025 | 0.055 | | 14229 | 0.026 | 0.026 |
| 0.05-0.20 | 5046 | 0.106 | 0.105 | | 11070 | 0.103 | 0.106 |
| 0.20-0.50 | 3416 | 0.329 | 0.173 | | 4329 | 0.314 | 0.323 |
| 0.50-0.80 | 2312 | 0.650 | 0.285 | | 1333 | 0.633 | 0.614 |
| 0.80-0.95 | 1613 | 0.883 | 0.395 | | 313 | 0.867 | 0.856 |
| 0.95-0.99 | 871 | 0.974 | 0.557 | | 29 | 0.966 | 0.966 |
| 0.99-1.00 | 696 | 0.996 | 0.756 | | 3 | 0.993 | 1.000 |
| naive: Brier 0.0947 | log loss 0.3396 | share beyond 0.01/0.99 0.508 | ||||
| exact: Brier 0.0671 | log loss 0.2298 | share 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
- Chapter 1 · Weight of Evidence: Single-Feature Likelihood Ratios, Decibans and the Sum of Four Features
- Chapter 3 · Correcting for Correlation: the Effective Number of Independent Features, Exact Weights and a One-Number Slope
- Chapter 4 · A Loss Matrix and Three Zones: Instant Buy, Referral and Decline
- Chapter 5 · Measuring More or Stopping: Cheap Evidence Is Worth Most at the Boundaries
- Chapter 6 · Channel Priors, Audits and Calibration: What Gets Referred Decides What a Store Can Learn
- Chapter 7 · East and West in the Sources: Suspecting the Neighbour of the Axe, and Peirce's Thermometer of Belief
- Chapter 8 · Closing the Loop: a Three-Zone Intake Procedure, the Refer-or-Buy Screener and a Pre-Registered Test