Skip to content

scikit-opls

Orthogonal Projections to Latent Structures (OPLS / OPLS-DA) with a scikit-learn interface.

OPLS (Trygg & Wold, 2002) splits the variation in X into a predictive part correlated with y and orthogonal parts uncorrelated with y, removes the orthogonal variation with an OSC-style orthogonal filter, then fits a standard PLS engine on the cleaned X. With n_orthogonal=0 it reduces exactly to PLSRegression.

Highlights

  • OPLS — regressor and supervised transformer.
  • O2PLS — two-block joint/orthogonal decomposition with bidirectional prediction.
  • Cross-validated n_orthogonal selection via scikit-learn's GridSearchCV (see Quickstart).
  • OPLSDA — binary classifier composing OPLS.
  • Lazy VIP scores on the estimators (OPLS.vip_ / ortho_vip_, also on OPLSDA), usable for feature selection via SelectFromModel(..., importance_getter="vip_").
  • Plotting — score and S-plot Displays.
  • Validation — permutation significance testing.

All estimators pass scikit-learn's check_estimator compliance suite, support clone / get_params / set_params, and work inside Pipeline and GridSearchCV.

See Installation and Quickstart to get going.

Getting Started

Check out the Quickstart guide to see examples of regression, cross-validation, and classification with scikit-opls.