DysTest

Leave-One-Out Cross-Validation as an Honest Accuracy Estimator for Webcam Gaze Calibration

Why Training Error Is the Wrong Metric for an Exactly-Interpolating Model

Uttam Panda, Christian Boer · Technical Note · 2026

A Thin-Plate Spline calibration model interpolates its training points near-exactly by construction, making training-set error an almost meaningless measure of real-world accuracy. This paper presents the use of Leave-One-Out Cross-Validation (LOO-CV) as the accuracy metric actually surfaced to the clinician and the platform: for each of the sixteen calibration points, a model is refit on the remaining fifteen and evaluated at the held-out point, and the median of these sixteen held-out errors is reported as the calibration quality score. We discuss why the median, rather than the mean, is the appropriate aggregator under sparse and unevenly distributed spatial coverage, and we present a worked case study in which a single corrupted training point — collected under a sign-inverted gaze axis — inflated LOO-CV error from an expected ~90 px to over 600 px, correctly flagging a defect that training error alone did not surface. We close with the operational threshold used to trigger an in-app recalibration prompt.

1. Introduction

A calibration model that fits its own training data well tells a clinician nothing about how that model will perform at a screen location the subject did not look at during calibration — which is, by definition, everywhere the subject looks during the rest of the assessment. This paper specifies why the platform reports Leave-One-Out Cross-Validation (LOO-CV) error, rather than training-set error, as its calibration-quality metric, and documents a real case in which this distinction caught a defect that training error alone did not surface.

2. Why Training Error Is the Wrong Metric

The companion paper in this series (Thin-Plate Spline Gaze Calibration with Adaptive Per-Point Regularization) establishes that the platform's calibration model is a Thin-Plate Spline fitted with per-point regularisation weights typically in the range λ ≈ 0.05–0.2. At these regularisation strengths, a TPS still interpolates its sixteen training points closely: residual training error at the training points themselves is small almost by construction, regardless of whether the underlying iris-offset-to-screen mapping the model has learned is any good between those sixteen points. A clinician or the platform's own quality gate that looked only at training error would, in the limit, find every calibration "excellent" — including calibrations built from corrupted or sign-inverted data, since the spline will dutifully interpolate even systematically wrong training points if asked to.

3. Leave-One-Out Cross-Validation

3.1 Procedure

For each of the n (typically sixteen) active calibration points, the platform:

  1. Removes that point from the training set, leaving n − 1 points.
  2. Refits the Thin-Plate Spline — including recomputing the z-score normalisation parameters and re-solving the regularised TPS linear system — on the remaining n − 1 points only, carrying forward each remaining point's own per-point regularisation weight unchanged.
  3. Evaluates the refitted model at the held-out point's iris-offset coordinates.
  4. Records the Euclidean pixel distance between the model's prediction and the held-out point's true screen target as that point's LOO error.

This is repeated once per calibration point, producing n independent error estimates, each describing how the model would have performed at a screen location it was not trained to expect — the only honest proxy available, without a genuinely separate validation dataset, for performance at arbitrary future fixation locations.

Figure 1. One LOO-CV fold: a single calibration point is held out, the spline is refit on the remaining fifteen, and the held-out point's prediction error is recorded. Repeated for all sixteen points, then aggregated by the median.

3.2 Aggregation: median, not mean

The platform reports the median, not the mean, of the n per-point LOO errors as the headline calibration-quality number. This choice matters because LOO-CV is most informative exactly where it is most volatile: removing a corner point from a sparse, unevenly distributed sixteen-point grid can force the refitted spline into genuine extrapolation rather than interpolation at that corner, producing an error an order of magnitude larger than the typical interior point's LOO error — correctly reflecting that the corner is, in fact, harder to predict from the remaining points, but in a way that would dominate a mean and obscure the fact that most of the screen is calibrated well. The median is robust to this: a single badly-extrapolating corner shifts the median only if it is one of several large errors, not merely the single largest one.

3.3 Bounding pathological extrapolation

Per-point LOO error is capped at the screen diagonal in pixels before aggregation, so that one genuinely pathological refit — for instance, a model that, deprived of one corner's constraint, predicts a screen location far outside the visible display — cannot produce an unbounded number that would otherwise need separate handling downstream. This cap is a numerical safety bound, not a substitute for investigating why a point produced extreme extrapolation error in the first place.

4. Case Study: A 662-Pixel LOO Error

During development, a calibration session was logged with a LOO-CV median error of 662 pixels — roughly four to seven times the ~90–150-pixel error typical of a well-collected sixteen-point calibration on a standard display, and well above the platform's recalibration-prompt threshold (§5). Root-cause analysis traced this to a sign error in the fallback gaze formula used by the proximity gate that determines which frames are accepted as calibration samples (§5 of the companion Thin-Plate Spline paper): with the horizontal axis inverted, the gate for outer, off-centre calibration dots failed to open for thirteen of sixteen points, because the inverted fallback estimate appeared to be on the wrong side of screen centre regardless of where the subject was actually looking. The resulting model was fitted almost entirely from three or four centrally-located points, with the TPS extrapolating — not interpolating — to predict screen locations at the corners. Training error remained unremarkable throughout, because the handful of points that were successfully collected were fitted closely; LOO-CV correctly identified the defect because removing any one of those few successfully-collected points left the model with almost no remaining constraint near the screen periphery.

This case is the practical justification for treating LOO-CV, not training error, as the number surfaced to the user-facing accuracy indicator and to the recalibration-prompt logic.

5. Operational Threshold

The platform compares the LOO-CV median against a configured warning threshold (160 px in current configuration) before completing calibration. A session whose LOO-CV median exceeds this threshold triggers an in-app prompt offering the subject the option to recalibrate before proceeding, rather than silently carrying a known-poor calibration model into the gaze-dependent portions of the assessment (story reading, word-icon matching). This threshold was set empirically from the distribution of LOO-CV medians observed across calibration sessions with otherwise-unremarkable training data, placing it comfortably above the typical range while still well below the multi-hundred-pixel errors associated with genuine pipeline defects such as the case in §4.

When the subject chooses to recalibrate, the redo pools with the prior attempt's sixteen points rather than discarding them (subject to a head-pose consistency check) — see Thin-Plate Spline Gaze Calibration with Adaptive Per-Point Regularization, §6. LOO-CV is then recomputed over whichever sixteen-point set results (pooled or, if head pose drifted, the new attempt alone), using exactly the procedure in §3 of this paper; pooling changes what data the sixteen points represent, not how LOO-CV is computed over them.

The same redo pools its eight-point validation results — used to fit a 6-parameter affine correction applied on top of, not merged into, the TPS surface above — rather than discarding them: see Thin-Plate Spline Gaze Calibration with Adaptive Per-Point Regularization, §6.5. This pooling is independently gated on the same head-pose check: if the calibration redo it immediately follows discarded its own pooled prior attempt for head-pose drift, the validation phase discards its prior-attempt history too, since the two are pooling evidence collected under the same head-pose assumption.

6. Discussion

LOO-CV's computational cost — n full model refits rather than one — is immaterial at n = 16 and a TPS system size on the order of 19×19 (sixteen RBF weights plus three affine terms), making it solvable in well under the per-frame budget required for the calibration UI to remain responsive. The method generalises beyond gaze calibration to any small-n, exactly- or near-exactly-interpolating model where training error is structurally uninformative; it is reported here specifically in the context of TPS gaze calibration because that is where the platform currently applies it, but the same reasoning would apply to any future per-session model fitted from a comparably small number of clinician- or system-administered calibration points.

7. Conclusion

Because a Thin-Plate Spline calibration model nearly interpolates its own training data by design, training error cannot distinguish a well-collected calibration from a pathologically under-sampled one. Leave-One-Out Cross-Validation, aggregated by median across the sixteen calibration points and capped at the screen diagonal, gives an honest, per-session accuracy estimate that has, in production use, correctly flagged calibration sessions undermined by upstream defects that training error alone did not surface.

References

  1. Stone, M. (1974). Cross-validatory choice and assessment of statistical predictions. Journal of the Royal Statistical Society, Series B, 36(2), 111–147. [Foundational LOO-CV theory]
  2. Hastie, T., Tibshirani, R., & Friedman, J. (2009). The Elements of Statistical Learning (2nd ed.). Springer. [Ch. 7, model assessment and cross-validation]
  3. Craven, P., & Wahba, G. (1978). Smoothing noisy data with spline functions. Numerische Mathematik, 31(4), 377–403. [LOO-CV applied to spline smoothing parameter selection]

Appendix A — Worked Numerical Example

For a 1920×1080 display (screenDiag ≈ 2203 px), held-out errors of [48, 61, 98, 152, 238, 245, 263, 299] px (eight active points, illustrative) sort to a median of (152 + 238) / 2 = 195 px. The same eight values' arithmetic mean is 175.5 px — close in this example, but the median is reported as the operational metric specifically because it remains stable under the heavy-tailed distributions that sparse corner extrapolation produces in less favourable cases, as in §4.

Appendix B — Pseudocode

function looErrorMedian(activeObs, lambdas, screenDiag):
    errors = []
    for i in range(len(activeObs)):
        heldOut = activeObs[i]
        trainSet = activeObs without index i
        model = fitTPS(trainSet, lambdas without index i)
        predicted = evalTPS(model, heldOut.irisOffset)
        err = euclideanDistance(predicted, heldOut.target)
        errors.append(min(err, screenDiag))
    return median(errors)

Important: DysTest is a screening tool and does not provide a formal medical diagnosis.