Skip to contents

Partial Least Squares Discriminant Analysis for classification. Calls caret::plsda() from caret.

Dictionary

This Learner can be instantiated via lrn():

lrn("classif.plsdaCaret")

Meta Information

  • Task type: “classif”

  • Predict Types: “response”, “prob”

  • Feature Types: “integer”, “numeric”

  • Required Packages: mlr3, mlr3extralearners, caret, pls

Parameters

IdTypeDefaultLevelsRange
ncompinteger2\([1, \infty)\)
prioruntyped"softmax"-
probMethodcharactersoftmaxsoftmax, Bayes-
methodcharacterkernelplskernelpls, 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

Author

awinterstetter

Super classes

mlr3::Learner -> mlr3::LearnerClassif -> LearnerClassifPlsdaCaret

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.


Method clone()

The objects of this class are cloneable with this method.

Usage

LearnerClassifPlsdaCaret$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

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