{
  "abstract": "Background: Evaluating machine-learning regression models in food spectroscopy using random row-wise cross-validation ignores hierarchical experimental structures (replicate scans, aliquot extractions, packaging batches, instruments, and harvest campaigns). While theoretical warnings caution against sample leakage, the chemometric literature lacks a multidataset empirical quantification of validation-induced optimism, its impact on model selection, and its underlying physical mechanisms. Methods: We executed an empirical multi-dataset benchmark across four benchmark food spectroscopy collections encompassing 12,706 source spectra/records, with 6,376 spectra evaluated in primary regression workflows: Cargill corn near-infrared (NIR; n = 240 spectra across 80 physical grain samples and 3 spectrometers; targets: moisture and protein), edible vegetable oils Raman (Gilbraith , 2024; n = 215 spectra across 52 distinct reference titration determinations; target: peroxide value), mango fruit dry matter NIR (Anderson , 2020; n = 4,233 calibration spectra across 5 cultivars and n = 1,448 external harvest season spectra; target: dry matter content), and Tecator meat NIR (n = 240 spectra with 24 duplicate pairs [48 rows participating in identical pairs], leaving 216 unique spectral profiles; targets: fat and moisture). Six regression algorithms—partial least squares (PLS), Ridge regression, support vector regression (SVR-RBF), Random Forest, XGBoost, and k-nearest neighbours (kNN, serving as a diagnostic sentinel)—were evaluated across four hierarchical validation tiers: Level 1 (random row-wise cross-validation), Level 2 (sample-aware group cross-validation, reference-valuegrouped validation, or deduplicated validation), Level 3 (cultivar-aware validation), and Level 4 (external instrument and seasonal holdout). Model specifications were held fixed across validation tiers to isolate validation design as the sole manipulated factor, and all spectral standardisation was strictly fitted within training partitions to eliminate unsupervised leakage. Results: Transitioning from random row-wise to structured validation systematically eroded apparent predictive performance across all 36 random-to-structured model–task contrasts, yielding a median validation-induced optimism ΔR2 of 0.0170 (mean 0.3290, interquartile range [0.0084, 0.3985]) and a median root-mean-square error inflation ratio (RR_RMSE = RMSE_structured / RMSE_random) of 1.1395 (mean 1.4277, IQR [1.0417, 1.4374], range [0.9406, 5.2645]). Degradation was especially pronounced under external domain transfer (median ΔR2 = 0.6399, median RR_RMSE = 1.8199). In edible oils containing replicate scans sharing identical titration reference values, random cross-validation produced catastrophic performance inflation for non-linear models: kNN collapsed from an apparent R2 of 0.8865 (RMSE 5.40 meq O2/kg) to −2.1443 (RMSE 28.43 meq O2/kg; RR_RMSE = 5.265), and Random Forest collapsed from R2 = 0.8437 to −0.5806 (RR_RMSE = 3.180). This replicate leakage completely inverted algorithm rankings (Spearman ρ = −0.886, p = 0.019; Kendall τ = −0.733, p = 0.056). Algorithm robustness under external transfer was domain-specific: Ridge was the most resilient model under Mango seasonal transfer (R2 = 0.6690, compared to R2 ≈ 0.13–0.17 for tree ensembles), whereas uncalibrated Corn instrument transfer caused severe degradation in linear models (Ridge R2 = −30.04, PLS R2 = −37.05) due to uncorrected spectrometer baseline shifts. In contrast, non-linear models exhibited smaller relative degradation under sensor transfer. Cross-partition nearest-neighbour spectral similarity dropped by up to 0.0164 under domain transfer. Across tasks, this similarity drop showed an exploratory positive association with kNN error inflation (Pearson r = 0.739, Spearman ρ = 0.912), consistent with a spectral-proximity mechanism whereby high optical similarity enables flexible models to interpolate training points rather than learning transferable chemical relationships. Conclusions: Random row-wise validation creates severe validation-induced optimism, distorts algorithm rankings, and rewards models that memorise experimental artefacts. Reporting standards, mandatory specimen-level split manifests, and the routine inclusion of kNN as a diagnostic canary are essential to restore methodological integrity and field deployability to machine learning in food analysis.",
  "abstract_shown": true,
  "affiliations": [
    "Department of Agricultural Science and Food Engineering, Lucian Blaga University of Sibiu, Dr. I. Ratiu Street 7–9, Sibiu, Sibiu, Romania, 550012"
  ],
  "article_type": null,
  "arxiv": null,
  "author_total": 1,
  "authors": [
    {
      "affs": [
        0
      ],
      "name": "Ketney Otto",
      "orcid": "0000-0003-1638-1154"
    }
  ],
  "bibtex": "https://research.draconitic.com/paper/04h06zk8hs53e.bib",
  "cited_by": 0,
  "doi": "10.26434/chemrxiv.15009168/v1",
  "fulltext_url": null,
  "id": "04h06zk8hs53e",
  "issns": [],
  "landing_url": "https://chemrxiv.org/doi/full/10.26434/chemrxiv.15009168/v1",
  "language": null,
  "licence": "CC-BY",
  "licence_label": "CC BY",
  "licence_source": "journal",
  "licence_url": "https://creativecommons.org/licenses/by/4.0/",
  "metadata_licence": null,
  "native_subjects": [
    [
      "openalex",
      "1602|Spectroscopy and Chemometric Analyses"
    ]
  ],
  "openalex": "W7213902338",
  "pdf_url": "https://chemrxiv.org/doi/pdf/10.26434/chemrxiv.15009168/v1",
  "pmcid": null,
  "pmid": null,
  "published": "2026-09-21",
  "publisher": "American Chemical Society (ACS)",
  "ris": "https://research.draconitic.com/paper/04h06zk8hs53e.ris",
  "sources": [
    {
      "first_seen": "2026-10-30T12:17:19Z",
      "native_id": "10.26434/chemrxiv.15009168",
      "source": "chemrxiv",
      "url": "https://chemrxiv.org/doi/full/10.26434/chemrxiv.15009168/v1"
    }
  ],
  "subjects": [
    {
      "field": "chemistry",
      "origin": "openalex:1602|Spectroscopy and Chemometric Analyses",
      "subfield": "analytical"
    }
  ],
  "title": "Quantifying Validation-Induced Optimism in Machine Learning for Food Spectroscopy: An Empirical Multi-Dataset Benchmark",
  "title_text": "Quantifying Validation-Induced Optimism in Machine Learning for Food Spectroscopy: An Empirical Multi-Dataset Benchmark",
  "type": "preprint",
  "updated_at": "2026-10-30T12:17:19Z",
  "url": "https://research.draconitic.com/paper/04h06zk8hs53e",
  "venue": "ChemRxiv",
  "versions": []
}