Binary classification with orthogonal partial least squares discriminant analysis (OPLS-DA).
Calls ropls::opls() from Bioconductor package ropls.
ropls is distributed via Bioconductor and not via CRAN, so it has to be installed with
BiocManager::install("ropls").
Initial parameter values
predIActual default:
NA, which letsropls::opls()determine the number of predictive components by cross-validation.Adjusted default:
1Reason for change: OPLS-DA is defined with a single predictive component, and a fixed number of components keeps the model comparable across resampling iterations.
orthoIActual default:
0Adjusted default:
1Reason for change: With
orthoI = 0no orthogonal component is extracted andropls::opls()fits plain PLS-DA instead of OPLS-DA.
permIActual default:
20Adjusted default:
0Reason for change: The permutation test is a model diagnostic that is not used for prediction and costs
permIextra model fits.
Suppressed output
ropls::opls() writes a diagnostic figure and a model summary by default.
Both are suppressed by fixing fig.pdfC and info.txtC to "none", so neither is exposed as a
hyperparameter.
Number of components
ropls::opls() requires predI + orthoI to not exceed the smaller of the number of observations and the
number of features, and errors otherwise.
With the initial parameter values this means that the learner needs at least two features.
Meta Information
Task type: “classif”
Predict Types: “response”
Feature Types: “integer”, “numeric”
Required Packages: mlr3, mlr3extralearners, ropls
Parameters
| Id | Type | Default | Levels | Range |
| predI | integer | - | \([1, \infty)\) | |
| orthoI | integer | 0 | \([0, \infty)\) | |
| algoC | character | default | default, nipals, svd | - |
| crossvalI | integer | 7 | \([1, \infty)\) | |
| log10L | logical | FALSE | TRUE, FALSE | - |
| scaleC | character | standard | none, center, pareto, standard | - |
| permI | integer | 20 | \([0, \infty)\) |
References
Thévenot, A. E, Roux, Aurélie, Xu, Ying, Ezan, Eric, Junot, Christophe (2015). “Analysis of the Human Adult Urinary Metabolome Variations with Age, Body Mass Index, and Gender by Implementing a Comprehensive Workflow for Univariate and OPLS Statistical Analyses.” Journal of Proteome Research, 14(8), 3322–3335. doi:10.1021/acs.jproteome.5b00354 .
See also
as.data.table(mlr_learners)for a table of available Learners in the running session (depending on the loaded packages).Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
mlr3learners for a selection of recommended learners.
mlr3cluster for unsupervised clustering learners.
mlr3pipelines to combine learners with pre- and postprocessing steps.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Super classes
mlr3::Learner -> mlr3::LearnerClassif -> LearnerClassifOPLS
Methods
Inherited methods
mlr3::Learner$base_learner()mlr3::Learner$configure()mlr3::Learner$encapsulate()mlr3::Learner$format()mlr3::Learner$help()mlr3::Learner$predict()mlr3::Learner$predict_newdata()mlr3::Learner$print()mlr3::Learner$reset()mlr3::Learner$selected_features()mlr3::Learner$train()mlr3::LearnerClassif$predict_newdata_fast()
Examples
# Define the Learner
learner = lrn("classif.opls")
print(learner)
#>
#> ── <LearnerClassifOPLS> (classif.opls): OPLS-DA ────────────────────────────────
#> • Model: -
#> • Parameters: predI=1, orthoI=1, permI=0
#> • Packages: mlr3, mlr3extralearners, and ropls
#> • Predict Types: [response]
#> • Feature Types: integer and numeric
#> • Encapsulation: none (fallback: -)
#> • Properties: twoclass
#> • Other settings: use_weights = 'error', predict_raw = 'FALSE'
# Define a Task
task = tsk("sonar")
# Create train and test set
ids = partition(task)
# Train the learner on the training ids
learner$train(task, row_ids = ids$train)
print(learner$model)
#> OPLS-DA
#> 139 samples x 60 variables and 1 response
#> standard scaling of predictors and response(s)
#> R2X(cum) R2Y(cum) Q2(cum) RMSEE pre ort
#> Total 0.283 0.455 0.369 0.371 1 1
# Make predictions for the test rows
predictions = learner$predict(task, row_ids = ids$test)
# Score the predictions
predictions$score()
#> classif.ce
#> 0.2318841