Principal Component Regression model.
Calls pls::pcr() from pls.
Initial parameter values
modelActual default:
TRUEAdjusted default:
FALSEReason for change: keeps model objects compact because predictions do not require the stored model frame.
Meta Information
Task type: “regr”
Predict Types: “response”
Feature Types: “integer”, “numeric”, “factor”, “ordered”
Required Packages: mlr3, mlr3extralearners, pls
Parameters
| Id | Type | Default | Levels | Range |
| ncomp | integer | - | \([1, \infty)\) | |
| method | character | cppls | kernelpls, widekernelpls, simpls, oscorespls, cppls, svdpc | - |
| scale | logical | FALSE | TRUE, FALSE | - |
| model | logical | - | TRUE, FALSE | - |
| x | logical | FALSE | TRUE, FALSE | - |
| y | logical | FALSE | TRUE, 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
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::LearnerRegr -> LearnerRegrPcr
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::LearnerRegr$predict_newdata_fast()
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