approximate_press — Approximate PRESS (leave-one-out by hat-matrix)

Group: Diagnostic · Registry tolerance: 1e-10

Description

Approximate-PRESS component selection (§29)

Registry note — R pls::plsr(validation='LOO', method='simpls', scale=FALSE)$validation$PRESS. Default pls4all path runs true LOO PRESS over the same SIMPLS kernel and matches R bit-for-bit; cfg.approximate_press_legacy = 1 falls back to the pre-0.97.4 Eastment-Krzanowski training-residual approximation.

Parameters

Name

Type

Default

Notes

max_components

int

6

registry benchmark cell value

Explanations

Bibliographic source

Allen, D. M. (1974). The relationship between variable selection and data augmentation and a method for prediction. Technometrics 16(1), 125–127.

Mathematical principle

Exact leave-one-out cross-validation requires \(n\) refits and costs \(O(n^2 p k)\). The approximate PRESS uses the hat-matrix shortcut: the leave-one-out residual for sample \(i\) is approximately \(r_i^{(-i)} \approx r_i / (1 - h_{ii})\), where \(h_{ii}\) is the diagonal of the hat matrix \(\mathbf{H} = \mathbf{T}(\mathbf{T}^{\top}\mathbf{T})^{-1}\mathbf{T}^{\top}\). Total PRESS is \(\sum_i (r_i^{(-i)})^2\), computed in \(O(n p k)\) from a single fit.

The approximation is exact for OLS and tight for PLS as long as no single \(h_{ii}\) approaches 1 (a high-leverage outlier). Use exact LOO when the approximate PRESS diverges from the cross-validated RMSEP by more than a few percent.

Drives the one-SE rule for selecting the component count \(k\).

Implementation

n4m_approximate_press_compute. Returns a length-\((k_{\max}+1)\) vector indexed by component count.

MATLAB header (bindings/matlab/+pls4all/approximate_press.m):

pls4all.approximate_press  PRESS-curve component selection.

   res = pls4all.approximate_press(X, Y, max_components)

 For each k ∈ {1, …, max_components}, fits SIMPLS and approximates
 PRESS via leverage-inflated in-sample residuals. Returns:

Usage

Every pls4all binding tab dispatches into the same C kernel; the external libraries listed at the bottom of the page are the parity references registered in benchmarks.parity_timing.registry. Switch tabs to read the same fit in your language. The R package now ships drop-in-compatible facades for the CRAN pls package (plsr, pcr, mvr) and for the mdatools::pls(x, y, ...) matrix idiom — those tabs appear only on the methods that have a meaningful equivalence.

pls4all bindings

/* C ABI — libn4m */
n4m_context_t* ctx = n4m_context_create();
n4m_config_t*  cfg = n4m_config_create();
n4m_method_result_t* res = NULL;
n4m_approximate_press_compute(ctx, cfg, &x_view, &y_view, /* hyperparams */, &res);
/* … read coefficients / mask / scores via */
/* n4m_method_result_get_double_matrix / vector / scalar … */
n4m_method_result_destroy(res);
n4m_config_destroy(cfg);
n4m_context_destroy(ctx);
import pls4all
from pls4all._methods import approximate_press_compute
with pls4all.Context() as ctx, pls4all.Config() as cfg:
    res = approximate_press_compute(ctx, cfg, X, y)
# then: res.matrix("predictions"), res.matrix("coefficients"),
# res.vector("mask"), res.scalar("intercept"), …
from pls4all.sklearn import approximate_press
result = approximate_press(X, y, n_components=2)
library(pls4all)
# Unified low-level dispatcher (May 2026 R cleanup):
res <- pls4all_method("approximate_press", X, y,
                      n_components = 2L, params = list(max_components = 6L))
# res is a named list with MethodResult arrays/scalars.
# selected_indices / top_k_intervals are 1-based.
res = pls4all.approximate_press(X, y, 2);
% see header of bindings/matlab/+pls4all/approximate_press.m for full
% parameter surface:
%   res = approximate_press(X, Y, max_components)
yhat = predict(res, Xtest);

No idiomatic classdef wrapper — invoke pls4all.fit("approximate_press", X, y, …) directly from the unified MEX factory.

Registry parity references 📐

  • 📐 ref.r_pls (R · r) — pls 2.8.5 · strict (rmse_rel ≤ 1e-10) — R pls::plsr(validation='LOO', method='simpls', scale=FALSE)$validation$PRESS. Default pls4all path runs true LOO PRESS over the same SIMPLS kernel and matches R bit-for-bit; cfg.approximate_press_legacy = 1 falls back to the pre-0.97.4 Eastment-Krzanowski training-residual approximation.

Benchmarks

Adaptive wall-clock per cell measured against full_matrix.csv. Only backends that implement this method are listed; libraries without the method are omitted.

Verdict  ·  ✓ ref / ≈ ref / ~ shape mark a reference-gate pass at strict / relaxed / qualitative tolerance  ·  ✓ bind = pls4all binding agrees with the C++ baseline  ·  ⇄ cross-check = documented by-design selector/RNG/model, noncanonical API/facade convention, or secondary oracle  ·  ✗ divergent  ·  ⚠ error  ·  — not run. The fastest backend per column is marked 🏆.

Reference gate: strict — numeric equivalence (rmse_rel_tol 1e-10).

Rows tagged with 📐 are the canonical parity references for this method (declared in parity_timing.registry). C++ and external rows show reference parity; pls4all language bindings show binding parity against the C++ backend. Hover the icon for role and tolerance band.

BackendParity200×30 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ ref 2e-1528.4 ms
Python · pls4all
pls4all.python✓ bind28.1 ms
pls4all.sklearn✓ bind28.1 ms
R · pls4all
pls4all.R✓ bind24.7 ms🏆
pls4all.R.formula✓ bind25.5 ms
pls4all.R.mdatools✓ bind25.3 ms
pls4all.R.pls✓ bind25.7 ms
R · external
📐ref.r_plssource69.5 ms
BackendParity200×30 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ ref 2e-1528.9 ms
Python · pls4all
pls4all.python✓ bind28.8 ms
pls4all.sklearn✓ bind28.8 ms
R · pls4all
pls4all.R✓ bind24.9 ms🏆
pls4all.R.formula✓ bind25.2 ms
pls4all.R.mdatools✓ bind25.5 ms
pls4all.R.pls✓ bind25.4 ms
R · external
📐ref.r_plssource69.2 ms
BackendParity200×30 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ ref 2e-1529.4 ms
Python · pls4all
pls4all.python✓ bind28.6 ms
pls4all.sklearn✓ bind28.9 ms
R · pls4all
pls4all.R✓ bind24.5 ms🏆
pls4all.R.formula✓ bind25.0 ms
pls4all.R.mdatools✓ bind24.9 ms
pls4all.R.pls✓ bind25.2 ms
R · external
📐ref.r_plssource67.7 ms

See also: benchmark overview · methods index · interactive dashboard