Performs bagged (bootstrap aggregating) predictions using an ensemble of ccModel objects. This function averages predictions from multiple models to improve stability and accuracy.
Arguments
- ccModel
A list of
ccModelobjects representing the ensemble of models to use for bagged prediction. Each model should be a valid ccModel instance.- Exp
A matrix or data frame containing the expression data to be classified.
- scORpat
A character string specifying whether the data represents single-cell ("sc") or phenotype ("pat") data. This parameter is passed to the underlying prediction functions.
Value
A matrix of averaged predictions where each element represents the aggregated probability or classification score across all models in the ensemble. The output is computed as the mean of all individual model predictions.
Details
This function implements model bagging by:
Iterating over each model in the
ccModellist usingpurrr::mapSelecting the appropriate prediction function based on the model's architecture ("DenseNet" vs "Standard")
Averaging all predictions using
Reduce("+", out) / length(out)
The function supports two architectures:
"DenseNet": Uses
DEGAS::predClass2for prediction"Standard": Uses
DEGAS::predClass1for prediction
If an unsupported architecture is encountered, the function will abort with an informative error message.
References
Johnson TS, Yu CY, Huang Z, Xu S, Wang T, Dong C, et al. Diagnostic Evidence GAuge of Single cells (DEGAS): a flexible deep transfer learning framework for prioritizing cells in relation to disease. Genome Med. 2022 Feb 1;14(1):11.
See also
Other DEGAS:
DoDEGAS(),
LabelBinaryCells(),
LabelContinuousCells(),
LabelSurvivalCells(),
Vec2sparse(),
readOutputFiles.optimized(),
runCCMTL.optimized(),
runCCMTLBag.optimized(),
writeInputFiles.optimized()
Examples
if (FALSE) { # \dontrun{
# Create an ensemble of models
model_list <- list(model1, model2, model3)
# Perform bagged prediction on expression data
predictions <- predClassBag(
ccModel = model_list,
Exp = expression_matrix,
scORpat = "sc"
)
# Use the averaged predictions for downstream analysis
class_assignments <- ifelse(predictions > 0.5, "Class1", "Class2")
} # }