Partial Least Squares Discriminant Analysis Learner
Source:R/learner_caret_classif_plsdaCaret.R
mlr_learners_classif.plsdaCaret.RdPartial Least Squares Discriminant Analysis for classification.
Calls caret::plsda() from caret.
Meta Information
Task type: “classif”
Predict Types: “response”, “prob”
Feature Types: “integer”, “numeric”
Required Packages: mlr3, mlr3extralearners, caret, pls
Parameters
| Id | Type | Default | Levels | Range |
| ncomp | integer | 2 | \([1, \infty)\) | |
| prior | untyped | "softmax" | - | |
| probMethod | character | softmax | softmax, Bayes | - |
| method | character | kernelpls | kernelpls, widekernelpls, simpls, oscorespls | - |
References
Kuhn, Max (2008). “Building Predictive Models in R Using the caret Package.” Journal of Statistical Software, 28(5), 1–26. doi:10.18637/jss.v028.i05 .
Mevik, Bjorn-Helge, Wehrens, Ron (2007). “The pls Package: Principal Component and Partial Least Squares Regression in R.” Journal of Statistical Software, 18(2), 1–24. doi:10.18637/jss.v018.i02 .
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/basics.html#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 -> LearnerClassifPlsdaCaret
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.plsdaCaret")
print(learner)
#>
#> ── <LearnerClassifPlsdaCaret> (classif.plsdaCaret): Partial Least Squares Discri
#> • Model: -
#> • Parameters: list()
#> • Packages: mlr3, mlr3extralearners, caret, and pls
#> • Predict Types: [response] and prob
#> • Feature Types: integer and numeric
#> • Encapsulation: none (fallback: -)
#> • Properties: multiclass and twoclass
#> • Other settings: use_weights = 'error'
# 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)
#> Partial least squares classification, fitted with the kernel algorithm.
#> The softmax function was used to compute class probabilities.
# Make predictions for the test rows
predictions = learner$predict(task, row_ids = ids$test)
# Score the predictions
predictions$score()
#> classif.ce
#> 0.2608696