# Labeled workload mixtures
These are four constructed finite calculations, not measurements or a replay of
a historical storage system. Read/write labels are illustrative; 1 and 9 ms are
not claims about typical drive speeds.

## Three different quantities
The observed pooled distance uses each side's recorded class counts. The
common-weight pooled distance first replaces those proportions with explicit
positive rational weights summing to one, then discards labels. The conditional
summary is sqrt(sum_c w_c D_c^2), where D_c compares inverse empirical CDFs inside
class c. It is not the arithmetic mean of distances, a paired-request residual,
a population confidence interval, or a newly proposed validation standard.
Keep every D_c and count alongside the summary.

With reference read/write values 1/9 ms, swapping predictions produces zero
pooled distance but 8 ms in each class. Keeping conditional values correct while
changing read share from 3/4 to 1/2 produces 4 ms observed pooled distance and zero
conditional error. Reweighting both to 1/2 removes that proportion difference,
but also yields zero for reversed classes: common-weight pooling is not a cure
for lost labels. The fourth case combines changed proportions with reversed
classes so both observed pools match while both class errors remain 8 ms.

## Exact computation
Inputs are nonempty mappings from class names to (latency, multiplicity) pairs.
Latencies use nonnegative int or Fraction milliseconds; counts use positive
integers. Both sides and the explicit weight map must have exactly the same
classes. Missing/empty classes, zero-weight omissions, floats, booleans and
weights that do not sum exactly to one are rejected.

Normalize each class's multiplicities, multiply by its common weight, and sum
equal-value masses. An integer common denominator represents those rational
masses compactly; repeated observations are never allocated by the calculator.
Those new multiplicities are arithmetic representations, not extra observations.
The existing tail.py interval merger computes exact squared distances.
JSON includes original class counts, original proportions, common weights,
per-class distances, source hashes, runtime and actual generation time.

## Reproduce
From this directory, with Python standard library only:
```sh
python3 -B -m unittest -v test_mixture
python3 -B -O -m unittest -v test_mixture
python3 -B mixture.py --check mixture-results.json
```
Regeneration uses --write mixture-results.json and changes generated_at/runtime.
The test oracle explicitly expands small rational probability grids and does
not call tail.py or mixture.py for its distance calculation. It checks 4096
class-distribution pairs, plus absent classes, invalid weights, unequal class
counts, fractional latency, input preservation and a 10^30-count compact case.
This does not establish hardware accuracy or computational complexity bounds
for arbitrary-sized rational inputs.

## Interpretation and prior work
Common weighting is a descriptive comparison holding the conditional empirical
distributions fixed. A physical workload change may alter queueing, cache state,
request sizes and history, including inside a read/write class. No intervention
or causal effect is identified. Matching within-class distributions still loses
request identity and time order.

Kelly, Cohen, Goldszmidt and Keeton, Inducing Models of Black-Box Storage Arrays,
HPL-2004-108 (2004), section 3.4 explicitly gives the permutation/zero-demerit
critique; section 4.1 formalizes response-time distributions conditional on
request and system-state features. Our numerical controls are not a novel
discovery of that limitation or a reproduction of their forecasting models.
Primary-report mirror, accessed 2026-11-25:
https://shiftleft.com/mirrors/www.hpl.hp.com/techreports/2004/HPL-2004-108.pdf
Ruemmler and Wilkes (1994), Evaluation, also requires relevant calibration loads:
https://www.pdl.cmu.edu/Publications/HTML-Papers/DiskModeling/i.shtml
