Skip to contents

Principal Component Regression model. Calls pls::pcr() from pls.

Note

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

Initial parameter values

  • model

    • Actual default: TRUE

    • Adjusted default: FALSE

    • Reason for change: keeps model objects compact because predictions do not require the stored model frame.

Dictionary

This Learner can be instantiated via lrn():

lrn("regr.pcr")

Meta Information

  • Task type: “regr”

  • Predict Types: “response”

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

  • Required Packages: mlr3, mlr3extralearners, pls

Parameters

IdTypeDefaultLevelsRange
ncompinteger-\([1, \infty)\)
methodcharactercpplskernelpls, widekernelpls, simpls, oscorespls, cppls, svdpc-
scalelogicalFALSETRUE, FALSE-
modellogical-TRUE, FALSE-
xlogicalFALSETRUE, FALSE-
ylogicalFALSETRUE, FALSE-

References

Jolliffe, T. I (1982). “A note on the use of principal components in regression.” Journal of the Royal Statistical Society. Series C (Applied Statistics), 31(3), 300–303.

See also

Author

alexander

Super classes

mlr3::Learner -> mlr3::LearnerRegr -> LearnerRegrPcr

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

LearnerRegrPcr$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# Define the Learner
learner = lrn("regr.pcr")
print(learner)
#> 
#> ── <LearnerRegrPcr> (regr.pcr): Principal Component Regression ─────────────────
#> • Model: -
#> • Parameters: model=FALSE
#> • Packages: mlr3, mlr3extralearners, and pls
#> • Predict Types: [response]
#> • Feature Types: integer, numeric, factor, and ordered
#> • 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)
#> Principal component regression, fitted with the singular value decomposition algorithm.
#> Call:
#> pcr(formula = formula, data = data, model = FALSE)


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

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