Perplexity is a statistical measure of how well a probability model can predict new data. Lower perplexity indicates a better model.
perplexity(
x,
celdaMod,
useAssay = "counts",
altExpName = "featureSubset",
newCounts = NULL
)
# S4 method for SingleCellExperiment,ANY
perplexity(
x,
useAssay = "counts",
altExpName = "featureSubset",
newCounts = NULL
)
# S4 method for ANY,celda_CG
perplexity(x, celdaMod, newCounts = NULL)
# S4 method for ANY,celda_C
perplexity(x, celdaMod, newCounts = NULL)
# S4 method for ANY,celda_G
perplexity(x, celdaMod, newCounts = NULL)
Can be one of
A SingleCellExperiment object returned by
celda_C, celda_G or celda_CG, with the matrix
located in the useAssay
assay slot.
Rows represent features and columns represent cells.
Integer counts matrix. Rows represent features and columns represent
cells. This matrix should be the same as the one used to generate
celdaMod
.
Celda model object. Only works if x
is an integer
counts matrix.
A string specifying which assay
slot to use if x
is a SingleCellExperiment object.
Default "counts".
The name for the altExp slot to use. Default "featureSubset".
A new counts matrix used to calculate perplexity. If NULL,
perplexity will be calculated for the matrix in useAssay
slot in
x
. Default NULL.
Numeric. The perplexity for the provided x
(and
celdaModel
).
data(sceCeldaCG)
perplexity <- perplexity(sceCeldaCG)
data(celdaCGSim, celdaCGMod)
perplexity <- perplexity(celdaCGSim$counts, celdaCGMod)
data(celdaCSim, celdaCMod)
perplexity <- perplexity(celdaCSim$counts, celdaCMod)
data(celdaGSim, celdaGMod)
perplexity <- perplexity(celdaGSim$counts, celdaGMod)