pls_lda — PLS-LDA

Group: Classification & GLM · Registry tolerance: 1e-08

Description

PLS-LDA — LDA on PLS scores (§17 Phase 4)

Registry note — sklearn PLSRegression(scale=False) -> LinearDiscriminantAnalysis is the canonical reference. The in-kernel pooled-covariance LDA head reproduces sklearn’s multiclass decision_function at ~1e-15. legacy=True opts into the historical SIMPLS+scaled variant (not parity-equivalent).

Parameters

Name

Type

Default

Notes

n_components

int

3

registry benchmark cell value

n_classes

int

3

registry benchmark cell value

Explanations

Bibliographic source

Barker, M. & Rayens, W. (2003). Partial least squares for discrimination. Journal of Chemometrics 17(3), 166–173. DOI 10.1002/cem.785.

Mathematical principle

PLS-LDA is a two-stage classifier: first project \(\mathbf{X}\) into the PLS latent space using one-hot encoded class labels as \(\mathbf{Y}\), then fit Linear Discriminant Analysis on the resulting scores \(\mathbf{T} = \mathbf{X}\mathbf{W}\).

LDA in the latent space is well-conditioned (the score matrix has \(k \ll p\) columns by construction), and the PLS projection has already aligned the latent axes with the class separation direction. This is more robust than applying LDA directly to high-dimensional \(\mathbf{X}\), where the within-class covariance is singular.

The decision boundary is linear in the latent space (and therefore also linear in the original feature space via \(\mathbf{W}\)). For non-linear class boundaries use PLS-QDA or PLS-logistic.

Appropriate uses

Multiclass classification using supervised PLS scores followed by a shared-covariance Gaussian discriminant.

Limits and validation

LDA covariance assumptions apply in score space; score extraction and class imbalance must be handled inside validation.

Implementation

n4m_estimators_pls_lda_fit. The reference is composite (sklearn PLSRegression + sklearn LinearDiscriminantAnalysis); no library exposes a single PLS-LDA call.

Sources and provenance

Current implementation: cpp/src/core/pls_lda.cpp.

API and bindings

C ABI (ABI 2): n4m_estimators_pls_lda_fit. Use the linked public header for the exact signature, configuration, and result handles.

Python: no current AST-verified public n4m re-export was found for this method. The linked C ABI above is the documented surface in this checkout.

R (source-verified): pls_lda_fit(X, y_labels, n_components, n_classes = NULL).

The source signature has additional required inputs, so no example call is fabricated.

MATLAB / Octave (source-verified): pls_lda(X, y_labels, n_components, n_classes).

The source signature has additional required inputs, so no example call is fabricated.

Registry parity references 📐

  • 📐 ref.python_scikit_learn (python · python) — scikit-learn 1.8.0 · strict (rmse_rel ≤ 1e-08) — sklearn PLSRegression -> LinearDiscriminantAnalysis pipeline. pls4all’s PLS-LDA uses a single SIMPLS pass with an internal LDA head; sklearn fits PLS on dummy-encoded targets and feeds the scores into LDA — both are LDA on PLS scores but the latent bases diverge. We compare class boundaries via one-hot decision scores.

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.

BackendParity200×40 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ ref 3e-163.14 ms🏆
Python · archived pls4all benchmark
pls4all.python✓ bind7.48 ms
Python · external
📐ref.python_scikit_learnsource7.32 ms
BackendParity200×40 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ ref 3e-166.86 ms
Python · archived pls4all benchmark
pls4all.python✓ bind4.05 ms🏆
Python · external
📐ref.python_scikit_learnsource4.54 ms
BackendParity200×40 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ ref 3e-161.95 ms🏆
Python · archived pls4all benchmark
pls4all.python✓ bind2.67 ms
Python · external
📐ref.python_scikit_learnsource3.59 ms

See also: benchmark overview · methods index · interactive dashboard