ecr — ECR — Elastic Component Regression¶
Group: Calibration transfer · Registry tolerance: 1e-08
Description¶
Elastic Component Regression (Phase 50)
Registry note — One-shot octave-cli libPLS 1.95
ecr(X, y, A, 'center', alpha). Deterministic; n4m’s power-method convergence is aligned to libPLS powermethod.m, matching it to ~1e-15.
Parameters¶
Name |
Type |
Default |
Notes |
|---|---|---|---|
|
|
|
current public binding signature |
|
|
|
current public binding signature |
|
|
|
current public binding signature |
|
|
|
current public binding signature |
Explanations¶
Bibliographic source¶
Li, H.-D., Liang, Y.-Z. & Xu, Q.-S. (2010). Uncover the path from PCR to PLS via elastic component regression. Chemometrics and Intelligent Laboratory Systems 104(2), 341–346. DOI 10.1016/j.chemolab.2010.08.003.
Mathematical principle¶
For each component the implementation forms \(\mathbf H=(1-\alpha)\mathbf X^T\mathbf X+\alpha(\mathbf X^T\mathbf Y)(\mathbf X^T\mathbf Y)^T\), takes its dominant eigenvector, computes the corresponding scores and loadings, and sequentially deflates X and Y. alpha therefore interpolates the implemented variance and squared-covariance criteria.
Appropriate uses¶
Supervised dimension reduction that explicitly blends X variance and X–Y covariance before regression.
Limits and validation¶
alpha changes the eigensystem and must be validated; endpoint interpretations assume the implemented scaling and sequential deflation.
Implementation¶
The earlier scalar formula mixing \(w^TX^TXw\) with \(w^TX^TY\) was dimensionally incomplete for multivariate Y. The matrix H above is the authoritative implemented criterion.
Sources and provenance¶
Current implementation: cpp/src/core/ecr.cpp.
API and bindings¶
C ABI (ABI 2): n4m_estimators_ecr_fit. Use the linked public header for the exact signature, configuration, and result handles.
Python (verified public re-export):
from n4m.estimators.regression.latent import ecr
result = ecr(X, y)
Source signature: ecr(X, y, *, alpha: float = 0.5, n_components: int = 2) (n4m/_impl/native.py).
R (source-verified): ecr(formula, data, ncomp = 2L, alpha = 0.5, na.action = stats::na.omit).
The source signature has additional required inputs, so no example call is fabricated.
MATLAB / Octave (source-verified): ecr(X, Y, n_components, alpha).
The source signature has additional required inputs, so no example call is fabricated.
Registry parity references 📐
📐
ref.matlab_libpls(matlab · python) —libPLS1.95 · strict (rmse_rel ≤ 1e-08) — Octave-bridged libPLS 1.95ecr(X, y, A, 'center', alpha). Predictions computed as X_predict @ B + y_mean using the fitted coefficient matrix and centring parameters.
Benchmarks¶
Archived measurement identity. Backend labels in this table are the raw IDs recorded when the benchmark ran (including historical pls4all.* IDs). They preserve measurement provenance and do not describe a current public Python, R, or MATLAB binding; use the source-verified API and bindings section above for current entry points.
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 = archived binding-harness result 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-08).
Rows tagged with 📐 are the canonical parity references for this method (declared in parity_timing.registry). C++ and external rows show reference parity; archived language-harness rows show binding parity against the C++ backend. Hover the icon for role and tolerance band.
| Backend | Parity | 200×50 (ms) |
|---|---|---|
| C++ native · libn4m | ||
pls4all.cpp.blas+omp | ✓ ref 6e-16 | 2.16 ms🏆 |
| Python · archived pls4all benchmark | ||
pls4all.python | ✓ bind | 2.24 ms |
pls4all.sklearn | ✓ 4e-15 | 2.37 ms |
| R · archived pls4all benchmark | ||
pls4all.R | ✓ bind | 5.88 ms |
pls4all.R.formula | ✓ bind | 6.96 ms |
pls4all.R.mdatools | ✓ bind | 7.41 ms |
pls4all.R.pls | ✓ bind | 8.61 ms |
| MATLAB · external | ||
📐ref.matlab_libpls | source | 62.4 ms |
| Backend | Parity | 200×50 (ms) |
|---|---|---|
| C++ native · libn4m | ||
pls4all.cpp.blas+omp | ✓ ref 6e-16 | 2.19 ms |
| Python · archived pls4all benchmark | ||
pls4all.python | ✓ bind | 2.14 ms🏆 |
pls4all.sklearn | ✓ 4e-15 | 2.32 ms |
| R · archived pls4all benchmark | ||
pls4all.R | ✓ bind | 5.03 ms |
pls4all.R.formula | ✓ bind | 6.42 ms |
pls4all.R.mdatools | ✓ bind | 6.40 ms |
pls4all.R.pls | ✓ bind | 6.08 ms |
| MATLAB · external | ||
📐ref.matlab_libpls | source | 61.5 ms |
| Backend | Parity | 200×50 (ms) |
|---|---|---|
| C++ native · libn4m | ||
pls4all.cpp.blas+omp | ✓ ref 6e-16 | 2.11 ms🏆 |
| Python · archived pls4all benchmark | ||
pls4all.python | ✓ bind | 2.16 ms |
pls4all.sklearn | ✓ 4e-15 | 2.27 ms |
| R · archived pls4all benchmark | ||
pls4all.R | ✓ bind | 5.42 ms |
pls4all.R.formula | ✓ bind | 7.74 ms |
pls4all.R.mdatools | ✓ bind | 6.53 ms |
pls4all.R.pls | ✓ bind | 6.36 ms |
| MATLAB · external | ||
📐ref.matlab_libpls | source | 92.2 ms |
See also: benchmark overview · methods index · interactive dashboard