Skip to contents

Partial least squares regression. Calls pls::plsr() from pls.

Note

During prediction, all components ncomp used in training are used.

Dictionary

This Learner can be instantiated via lrn():

lrn("regr.plsr")

Meta Information

  • Task type: “regr”

  • Predict Types: “response”

  • Feature Types: “integer”, “numeric”, “factor”

  • Required Packages: mlr3, pls

Parameters

IdTypeDefaultLevelsRange
ncompinteger-\([1, \infty)\)
methodcharacterkernelplskernelpls, widekernelpls, simpls, oscorespls-
scalelogicalTRUETRUE, FALSE-
centerlogicalTRUETRUE, FALSE-
validationcharacternonenone, CV, LOO-
modellogicalTRUETRUE, FALSE-
xlogicalFALSETRUE, FALSE-
ylogicalFALSETRUE, FALSE-

References

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::LearnerRegr -> LearnerRegrPlsr

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.

Usage


Method clone()

The objects of this class are cloneable with this method.

Usage

LearnerRegrPlsr$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# Define the Learner
learner = lrn("regr.plsr")
print(learner)
#> 
#> ── <LearnerRegrPlsr> (regr.plsr): Partial Least Squares Regression ─────────────
#> • Model: -
#> • Parameters: list()
#> • Packages: mlr3 and pls
#> • Predict Types: [response]
#> • Feature Types: integer, numeric, and factor
#> • Encapsulation: none (fallback: -)
#> • Properties:
#> • Other settings: use_weights = 'error'

# Define a Task
task = tsk("mtcars")

# 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 regression, fitted with the kernel algorithm.
#> Call:
#> plsr(formula = formula, data = task$data())


# Make predictions for the test rows
predictions = learner$predict(task, row_ids = ids$test)

# Score the predictions
predictions$score()
#> regr.mse 
#> 16.65331