> ## Content Index
> Fetch the complete content index at: https://www.gauravalbal.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Teaching an algorithm Sanzo Wada's eye
- URL: https://www.gauravalbal.com/teaching-an-algorithm-sanzo-wadas-eye/
- Published: 2026-06-28T02:59:07.000Z
- Updated: 2026-11-05T18:07:52.000Z
- Description: The colours were easy. Teaching the metric how Wada combines them took five tries
- Author: Gaurav Albal
- Tags: Fun

sanzo-sampler · a case study

The colours were easy. Teaching the metric how Wada combines them took five tries.

I set out to generate palettes in the spirit of *A Dictionary of Color Combinations*. The colours were easy. Learning how Wada *combines* them took five tries — and each failure taught me I was measuring the wrong thing.

Clarification · 5 November 2026

The charts and saved palettes below are the original illustrations from this case study, published in June 2026\. They are not a current or reproduced benchmark. Their numerical labels have been left as published.

## The real story is the metric

Every fix was a better answer to one question: what makes a Wada combination *Wada*?

The palettes only improved because my yardstick did. Here's how it evolved.

metric v1

### Harmony score

Density of each pair's relationships among his combos.

✗ a coin flip

metric v2

### Diversity volume

Spread = the volume the colours span.

✗ collapsed to the muted core

metric v3

### Contrast number

Hit Wada's measured ΔE, ≈0.28.

✗ bought with saturation

metric v4

### Value vs chroma

Split contrast into value and saturation.

◑ the diagnosis

metric v5

### Learned quality vector

A tuned vector of Wada-ness; sample, don't maximise.

✓ the sampler I kept

ACT I

I trusted a harmony score I'd never tested.

The first sampler ranked colours by a learned *harmony* and chose with MMR. Before leaning on it, I ran a simple test: **show the score one real Wada combination and one random pairing of his colours — can it tell which is real?** A perfect judge is right 100% of the time; a useless one, 50% — a coin flip.

coin flip50%75%certain100% HARMONY · a coin flip GAMUT · a good guess 

Harmony scored a coin flip. Another way to see it: plot the scores it gives to real combinations versus random pairings. A good metric pulls them apart; harmony piles them on top of each other. The gamut (which colours, not how they're combined) is the signal that actually separates.

score → 

**Harmony score**  
real Wada random  
the two piles overlap → it can't tell them apart

score → 

**Gamut score**  
real Wada random  
the piles separate → this one can

what that blind score actually picked · saved samples

Next sample 

MMR is *sometimes* fine. But it's only as reliable as the score steering it — and that score is a coin flip, so good rolls are luck, not skill.

**The flaw:** a harmony score that can't tell Wada from random can't reliably steer toward Wada.

ACT II

So I reached for the "optimal" algorithm — and it went timid.

If I can't *score* harmony, lean on structure: a Determinantal Point Process, the canonical diverse-subset picker. But my kernel weighted "quality" so hard that the DPP huddled in the dense, muted *core*of the gamut. Every palette became three mid-tones at the same lightness — flatter than random.

Wada · same chroma budget

#253122Deep Slate Olive

#837e31Olive

#eeb480Pinkish Cinnamon

#f5ecc2Sulpher Yellow

Ranges all the way from near-black to pale, at low chroma.

ΔL**0.36**chroma max**0.10**ΔE**0.37**

mine · quality-weighted DPP

#864b4dRed Maple Leaf

#c65841Summer Fig

#978466Antique Royal Gold

#d2ae89Cheddar Biscuit

Stranded in the muted middle — no light, no dark.

ΔL**0.16**chroma max**0.14**ΔE**0.18**

**The flaw:** the metric had no notion that Wada *spreads*. Same mutedness; he ranges light→dark, I didn't.

ACT III

I forced contrast to a number — and got garish primaries.

I measured Wada's real contrast (mean ΔE ≈ 0.28) and tuned the kernel to hit it. The number matched; the palettes turned into loud primaries — because a single contrast number doesn't care *how* you reach it, and the cheapest contrast to buy is raw saturation.

Wada · more contrast, half the chroma

#111314Black

#1c4286Deep Lyons Blue

#a36aa5Aconite Violet

#fdc57eCinnamon Buff

ΔE 0.41 at chroma 0.12 — punch from value; colours stay muted.

ΔL**0.37**chroma max**0.12**ΔE**0.41**

mine · contrast-by-number

#6d4145Red Rumour

#e31f26Brutal Doom

#00918eSupermint

#d4aa83Maple Tan

Same ΔE, chroma 0.22: loud, not Wada.

ΔL**0.17**chroma max**0.22**ΔE**0.27**

**The flaw:** matching a scalar was necessary but not sufficient. It was blind to *which axis* the contrast lived on.

## Act IV · the diagnosis

I needed to distinguish value contrast from chroma contrast.

I stopped tuning and looked. The plot made the distinction I had been collapsing visible: contrast from lighter and darker colours is different from contrast bought with saturation. I needed the sampler to notice which kind it was producing.

← change in saturation → change in value (ΔL) ↑ 

Wada offsets — tall & thin: he moves in value, not saturation our garish attempt — round: it chased saturation

My isotropic kernel treated both directions the same, so it happily traded value for the saturation it should have left alone. The fix had to make the algorithm see colour the way the cloud is shaped.

## The gamut, and why it matters

Every Wada colour, in one picture.

Plot all 159 colours by lightness and saturation. They hug the left — low chroma — at every lightness. *That* muted band is the gamut. The whole job is: stay in the band, but travel up and down it.

muted band (Wada lives here) chroma → saturation lightness (dark → light) 

muted band (Wada lives here) chroma → saturation lightness (dark → light) 

**× garish picks** — shoved right, into saturation

muted band (Wada lives here) chroma → saturation lightness (dark → light) 

**◯ final picks** — stay in the muted band, spread top-to-bottom (value)

Left, the garish attempt breaks right out of the band into saturation. Right, the final sampler stays in the band and spreads top-to-bottom — contrast from value, exactly like Wada.

ACT V

The fix: measure quality as a vector, and let sampling do the rest.

The anisotropy is real — but baking it into a bespoke distance metric had a side-effect the two-sample test caught: it skewed palettes warm and clustered their hues. The cleaner fix puts the intelligence in the *quality*: a multidimensional, **Optuna-tuned vector of Wada-ness** — manifold proximity, value-conditional typicality (so dark colours aren't punished for being dark), mutedness, hue-fit. With that, diversity can be measured plainly (isotropic), and drawing a **k-DPP sample** instead of the single greedy-best yields the dark tail, the muted chroma, and a naturally graded saturated accent — no hand-tuned metric required.

Wada · a real combination

#40456aViolet Blue

#064f6eVandar Poel's Blue

#f68c50Apricot Orange

#f3a257Golden Yellow

Violet-blue to golden yellow: value-led, one warm accent.

ΔL**0.24**chroma max**0.15**ΔE**0.29**

mine · k-DPP, learned quality

#7a433cSweet Spiceberry

#c85444Chilli Cashew

#c2ae93Brown Bunny

#fbe6a0Rich Glow

The same character: value contrast, muted, one accent.

ΔL**0.28**chroma max**0.11**ΔE**0.30**

**The approach I kept:** value contrast **and** muted chroma at once — from a learned quality vector + sampling, not a bespoke metric.

## The whole journey, on one map

Four attempts circling one target.

The map makes the trade easier to see. A palette can stay muted and still go flat. It can gain contrast by becoming garish. I wanted room between those failures: a wider range of light and dark, with saturation under control.

too saturated too flat chroma → saturation ΔL → value contrast WADA — the target I · MMRII · timidIII · garishV · final recipe 

## One more fix underneath

I was even sampling colours wrong.

My candidate colours had been blobs jittered off the 159 named points — which sprayed a third of them out past the muted band, into saturation. I replaced it with sampling the gamut *region* directly.

chroma → 

**jitter off the 159 points**  
only 65% land in the muted band — the rest leak right, into saturation

chroma → 

**sample the gamut directly**  
100% in-band, by construction — and more varied

## Alternatives considered & discarded

Roads I didn't take.

#### More harmony features

I tried several feature sets, then moved on to a different question. That did not establish that every richer score would overfit.

#### Modelling dependence directly

I also tried a copula to model how palette features vary together. That is another way to ask what the sampler needs to preserve.

#### A hard chroma cap

Clipping saturation works but throws away Wada's value–chroma correlation. The learned metric keeps it.

#### Pure diversity

Drop quality entirely and the picker grabs garish gamut-edge outliers. Quality still has to gate what's allowed in.

#### Just widen the jitter

Bigger blobs clump harder around the 159 points and leak further out. The gamut region is the principled fix.

## Did I actually become Wada?

The honest test: can a classifier tell my palettes apart?

Matching a few averages is not the same as matching the distribution. I used a classifier to compare *generated* palettes with *real* Wada combinations on summary features in OKLab. That comparison can expose differences in the chosen features. It does not certify that a generator has learned Wada’s taste.

The failures I was trying to correct were visible in the palettes: too much warmth, clustered hues, washed-out colours. I changed how quality was scored and how palettes were sampled, then checked what those changes actually produced.

two-sample AUC — lower is more like Wada target score algo 0.50.60.70.80.91.0 0.991density score0.928\+ value targets0.89\+ vector score0.869\+ isotropic algo0.643\+ chroma term 

In each pair below, the book is on top and a saved sample from my generator is underneath.

the book (real Wada) ↑ my palettes (generated) ↓ ← looks like my palettes classifier score looks like the book → 

book

mine

book

mine

book

mine

book

mine

book

mine

book

mine

book

mine

| feature                         | Wada | before | after |
| ------------------------------- | ---- | ------ | ----- |
| warm balance (frac warm)        | 0.52 | 0.65   | 0.57  |
| hue spread                      | 0.40 | 0.15   | 0.40  |
| chroma (saturation)             | 0.10 | 0.08   | 0.10  |
| saturated accent (chroma range) | 0.10 | 0.07   | 0.10  |
| dark reach (min L)              | 0.45 | 0.51   | 0.44  |

The summaries gave me things to inspect. The palettes still had to work.

## What I can claim from this

Choosing a sampler does not establish a ceiling.

I kept the k-DPP sampler because it gave me useful controls. That is a reason to use it, not a claim that another generator couldn’t do better.

I need to correct the comparison that used to sit here. Its cached summaries conflict, and the AUC/novelty table was hardcoded in the presentation builder. I couldn’t connect those entries to reproducible runs. I’ve removed the ranking and the claim of a ceiling on novel generation. This comparison didn’t establish either.

The next comparison needs a recorded run, with the method, data, and result kept together.

## Where we landed

Pick a colour. Inspect the palette it produced.

These are **14 saved samples from the generator**. Choose a starting hue to inspect the palette generated around it, with that colour forced in. Beside it is the closest real combination from the book, selected by its nearest colour. The wheel displays these examples; it does not run the sampler in your browser.

pick  
a hue

mine · centred on 

closest real Wada combination

Method described in this case study: manifold KDE · gamut sampling · quality weighting · k-DPP sampling

The available two-sample evaluation splits rows for the classifier after fitting the generator to the full corpus. That is not held-out generator-training data. No new evaluation was run for this editorial update.

Colour data: [Matt DesLauriers’ dataset](https://github.com/mattdesl/dictionary-of-colour-combinations?ref=gauravalbal.com) from Sanzo Wada’s *A Dictionary of Color Combinations* (Seigensha), based on [Dain M. Blodorn Kim’s original compilation](https://github.com/dblodorn/sanzo-wada?ref=gauravalbal.com). The lesson that paid for the detour: when a metric won't separate signal from noise, the fix is rarely more features — it's asking whether you're measuring the right thing at all.