Tune ncomp using cross-validation.
CVTune_ncomp(
reference,
assayName = "logcounts",
phenotypes = NULL,
YY = NULL,
center = TRUE,
scale = FALSE,
ncompLimits = c(1, 100),
gridSize = 20,
ncompGrid = NULL,
selectedFeat = NULL,
Kfolds = 5,
regMethod = "PCA",
labelCode = "-1,1",
Ncores = 1,
seed = 5202056,
ncomp = NULL
)SingleCellExperiment object.
Character.
Character.
Matrix.
Logic.
Logic.
Vector.
Integer.
Vector.
Vector.
Integer.
Character.
Character.
Integer.
Integer. The function sets the seed with withr::local_seed(), so the session's random-number state is restored on exit.
Chosen number of components, or NULL to choose after the
cross-validation: in an interactive session the function plots the loss
and asks; otherwise it takes the grid value with the lowest loss.
A list.