Wine Domain Transfer

Can a model trained on red wine read white wine records?

A model can look useful on familiar records and stumble when the source changes. I used the public UCI Wine Quality files to make that question inspectable: train on red wine records, then ask the same small model to predict scores for white wine records, and reverse the direction. The target is the dataset's expert sensory score. This tool does not taste wine or assess whether it is safe to drink.

I trained six small neural models on November 4, 2026: a red-source and a white-source model for each of three fixed seeds. Each had 923 training rows and the same update budget. I kept their own validation sets and all test cases. Publishing this saved experiment does not add a new training run.

The familiar-source model had lower average error in each target domain. That summary misses the failures: it was worse in 1,585 of 3,969 paired seed/case comparisons. Those comparisons reuse 1,323 cases. The white-trained model transferred to red records so poorly that its average error exceeded the error of simply predicting its own training-set mean. The fixed first example also favors the cross-source model at seed 17, and remains the default.

The browser page lets a reader load a recorded row or enter eleven source-scale numbers, compare all six saved outputs, and download the full input, model results and provenance. The result tables, both constant baselines and every worse case are included. Equal row budgets do not isolate the effect of a source change: feature support, duplicate weights, normalization, score distributions and validation sets also differ. Exact matching feature tuples are not winery IDs or proof of independent measurements.

红葡萄酒学到的评分规则,能直接拿去看白葡萄酒记录吗?

在熟悉的数据上表现不错的模型,换一批来源还管用吗?我用公开的 UCI Wine Quality 红、白葡萄酒记录做了一个可以逐条查看的对照:用红葡萄酒记录训练的小模型去预测白葡萄酒记录的评分,再反过来做。这里的目标是数据集里的专家感官评分;工具不能品酒,也不能判断饮用安全。

这六个小模型在2026年11月4日完成训练:三个固定随机种子,每个种子各训练一个红葡萄酒模型和一个白葡萄酒模型。每个模型使用923条训练记录及相同更新预算,保留各自来源的验证集和完整测试集。今天发布的是这次已保存实验,没有新增训练。

同来源模型在两类测试记录上的平均误差都较低,但在3,969次配对中有1,585次反而更差;这些比较重复使用同一批1,323条案例。白葡萄酒模型迁移到红葡萄酒记录后,平均误差甚至高于始终输出自身训练集平均分的简单基线。预先固定的默认案例在种子17下也更偏向跨来源模型,我保留了这个负例。

页面可以载入一条原始记录,或填写十一项原始尺度数值,查看六个保存模型的输出,并下载完整输入、结果和来源。平均表格、常数基线和全部变差案例都在包里。相同训练条数不能排除其他差异:特征范围、重复记录权重、归一化、评分分布和验证集也不同。数值完全相同的特征组合不是酒庄身份,也不能证明测量独立;结果不构成化学因果、健康、认证或未来来源的保证。

The Hub license badge covers my original code and documentation (Apache-2.0). The source data and derived weights, normalizers, catalogue, results and scientific figures retain Cortez et al./UCI attribution under CC BY 4.0; see LICENSES.md and NOTICE. Neither badge replaces those separate data terms.

Compare small red-trained and white-trained regressors on both complete holdouts. The two source pools have equal row/update budgets, paired initializations and their own validation sets. All input duplicates share an initial split across colors. This is a descriptive known-data experiment with a working local browser demo, not a novel method or historical blind benchmark.

Each model uses11physicochemical inputs to predict the source sensory score as a continuous number. The ordinal score is treated numerically for MAE/MSE, an explicit modeling assumption. Source names describe the median of at least3expert evaluations on0..10scale. The files do not provide individual chemistry units, so the demo uses source scales without inventing units. No tasting, health, causal chemistry, certification or future-domain assurance. Full interpretation limits.

Results, including failures

All341red+982white test cases remain. Neural cells are arithmetic means of three seed metrics, not ensembles, confidence intervals or independent new test cases. Fit-mean baselines are two analytic constants, not extra neural fits.

Test domain Red-trained MAE White-trained MAE Red fit-mean MAE White fit-mean MAE Cases/seed
Red .476144 .746975 .647566 .636872 341
White .649987 .586350 .748883 .674610 982

The white-trained neural model loses to its own constant baseline on red holdout. In-domain models are worse in1585of3969paired seed/case comparisons (321red-target/1264white-target). All failures remain; these reuse1323cases, not3969independentcases. The fixed default red:0002 also favors the cross-domain model at seed17; it was chosen before model testing, not selected as a success.

All10584method predictions, 192overall/quality0..10 groups including empty-support nulls, all3969pairs, every in-domain failure, every cross-domain failure, complete summary. Current test outputs lie within0..10without clipping/rounding; that does not bound arbitrary inputs.

Full training and paired-error inventory

Full-size all-test-prediction figure. Figures include all600own-source validation epochs, all3969paired differences and all7938neural test outputs, with analytic baseline comparisons. No filtered wins, jitter, uncertainty bands or significance claim.

Run the demo

Serve this folder through static HTTPS or loopback; file:// is not supported:

python3 -m http.server 8000 --bind 127.0.0.1

Open the local page in a modern browser with native modules, Web Crypto, BigInt and structuredClone. No build step, external model API, fonts, analytics or browser storage. The model bundle, catalog and fixed result bytes are hash-checked before activation. Load a recorded source ID or enter all11values. JSON.parse last-key semantics apply and raw JSON is retained. JSON mode requires exactly the original feature names and finite numeric values; fields accept trimmed decimal/scientific notation, no hex or blank-to-zero conversion. A JSON failure or changed seed cannot resurrect stale field inputs; explicit field edits/buttons restore field mode. Clear removes all current input/report DOM. Seed highlights a pair; all six outputs remain available.

Reports contain all11features/order/source-scale description, all6outputs, train-only normalizers, exact-source matches/fit flags, marginal support flags, two means, selected epochs, artifact/source hashes and attribution. Exact numeric source matches are not authenticated measurements; marginal ranges do not establish joint support. Deliberate downloads contain all inputs; edits are lost on refresh. Tables scroll horizontally with keyboard focus on narrow screens; scientific figures have full-size links.

Source and fixed study

UCI186 Wine Quality, Cortez/Cerdeira/Almeida/Matos/Reis2009, DOI10.24432/C56S3T, CC BY4.0. UCI summary4898is white only; original1599red+4898white=6497rows are preserved. Exact native original ZIP/three members and hashes: SOURCE.json. Original names/metadata read; the2009paper's full text was unavailable, and its method/results are not reproduced. Research basis, license scope.

Input-only Decimal canonical11-feature key across both colors, fixed SHA256mod10 split:60%fit pool/20%validation pool/20%test buckets. There are5318groups/1179duplicate-excessrows,2cross-color groups, no conflicting-quality groups in current bytes. Equal budgets use label-blind SHA source-ID ranking:923fit/335validation each. White2016unusedfit/642unusedvalidation remain explicit. All6497membership records, source audit. Exact keys are not producer IDs or proof of independence; equal ROW budgets are not equal unique/effective samples.

Six actual11→24tanh→1linear fits,313parameters each, seeds17/41/73perdomain. Three initial sets shared across paired domains, six trajectories.100epochs/batch64/Adam.003/MSE+.0001weightL2, each1500updates/92300rowvisits; total600epochs/9000updates/553800visits. Each domain's fit-only feature/target normalization and own335-row validation MAE select earliest best checkpoint (red31/78/31; white52/39/39). No target-domain validation for cross-domain model, no test tuning. Equal budgets do not isolate shift: source labels/support/normalizers/validation/duplicate weights differ. Fixed protocol, configuration, all traces.

Reproduce on a copy

Code was checked with Python3.14.7/NumPy2.5.4 and Node24.19.0 (use Node22+). Optional scientific plotting uses Matplotlib, pinned separately. Keep frozen author artifacts unchanged; tests write result files in their copy.

python3 -m venv .venv
.venv/bin/pip install -r requirements.txt
PYTHONDONTWRITEBYTECODE=1 .venv/bin/python test_core.py
PYTHONDONTWRITEBYTECODE=1 .venv/bin/python verify_results.py
node test_portable.mjs

Independent scalar gradient/Adam, all9948selected-validation/test neural forwards, all6497memberships/train-onlystats/192metrics/3969pairs/600trace selections and full JavaScript forward checks are included. Validation evidence. Native-browser evidence uses actual native report files; compact summaries are bundled, raw parent evidence is held for independent review. Running verify_native.py requires those26actual files in its directory; it does not replace a reviewer’s own native-browser check.

For six fresh fits/evaluation, preserve frozen author files, use new output directories:

OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 VECLIB_MAXIMUM_THREADS=1 PYTHONDONTWRITEBYTECODE=1 .venv/bin/python train.py --out fresh-run
PYTHONDONTWRITEBYTECODE=1 .venv/bin/python evaluate.py --run fresh-run --out fresh-evaluation

Frozen protocol/source/code and training artifacts are verified by gates. test_core.py writes a gradient result to its own folder; on a different numerical platform, run that synthetic test from a separate core.py/test_core.py copy so the author’s frozen gradient record remains untouched before training. Fresh platform numerics/timing can differ; no byte-identical cross-platform claim. Independent review should record its own output hashes and compare numerical values/selection explicitly, without editing accepted source or author gates.

Identity work:wine-domain-transfer:v1, version0.1.0. Today development/review/freeze only. Local verification does not establish independent acceptance, free cloud deployment, publication or adoption. Later HF release follows the original daily workflow after independent acceptance.