| predict.fastPLS | R Documentation |
Generates predictions for new samples from fitted PLS-SVD, SIMPLS-family, OPLS, or kernel PLS models. Stored centering, scaling, latent projections, and model-specific filtering are applied before producing numeric response predictions or classification labels.
## S3 method for class 'fastPLS'
predict(
object,
newdata,
Ytest = NULL,
proj = FALSE,
backend = NULL,
n.cores = NULL,
top = NULL,
raw_scores = FALSE,
...
)
object |
A fitted |
newdata |
Numeric predictor matrix. |
Ytest |
Optional observed response. When supplied, the predictions are
passed to |
proj |
Logical; return projected |
backend |
Prediction backend: |
n.cores |
Number of CPU cores requested for compiled host operations.
An explicit value takes precedence over |
top |
Number of ranked classes to return for classification. The
default |
raw_scores |
If |
... |
Required by the S3 generic. Additional arguments are not supported and produce an error, which prevents obsolete or misspelled options from being silently ignored. |
A list containing Ypred, optional independent-test Q2Y, optional
Ttest, optional Ypred_top and Ypred_top_score ranked-class outputs,
and optional raw classification scores. When Ytest is supplied,
metrics contains the complete result returned by evaluate() for every
requested component count. For a rank-limited PLS-LDA fit, the prediction
path retains every requested position and repeats the last estimable class
prediction and discriminant scores.
X <- as.matrix(mtcars[, c("disp", "hp", "wt", "qsec")])
y <- mtcars$mpg
fit <- pls(X, y,
ncomp = 2, method = "simpls", backend = "cpu",
return_variance = FALSE
)
pred <- predict(fit, X[seq_len(3), , drop = FALSE])
pred$Ypred
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.