DeconvDLModel-class {SpatialDDLS} | R Documentation |
The DeconvDLModel Class
Description
The DeconvDLModel
object stores all the information
related to deep neural network models. It consists of the trained model, the
training history, and the predictions on test data. After running
calculateEvalMetrics
, it is possible to find the performance
evaluation of the model on test data (see ?calculateEvalMetrics
for details).
Details
The steps related to Deep Learning are carried out using the keras and
tensorflow packages, which use the R6 classes system. If you want to
save the DeconvDLModel
object as an RDS file,
SpatialDDLS provides a saveRDS
generic function that transforms
the R6 object containing the trained model into a native valid R object.
Specifically, the model is converted into a list with the architecture of the
network and the weights learned during training, which is the minimum
information needed to use the model as a predictor. If you want to keep the
optimizer state, see ?saveTrainedModelAsH5
. If you want to
store either the DeconvDLModel
or the
SpatialDDLS
objects on disk as RDA files, see
?preparingToSave
.
Slots
model
Trained deep neural network. This slot can contain an R6
keras.engine.sequential.Sequential
object or a list with two elements: the architecture of the model and the resulting weights after training.training.history
List with the evolution of the selected metrics during training.
test.metrics
Performance of the model on test data.
test.pred
Predicted cell type proportions on test data.
cell.types
Vector with cell types considered by the model.
features
Vector with features (genes) considered by the model. These features will be used for subsequent predictions.
test.deconv.metrics
Performance of the model on test data by cell type. This slot is generated by the
calculateEvalMetrics
function (see?calculateEvalMetrics
for more details).interpret.gradients
Gradients for interpretation. SpatialDDLS provides some functions to better understand prediction made by the model (see
?interGradientsDL
for more details). This slot is a list of either one or two elements: gradients of either the loss function or the predicted class with respect to the input variables using pure (only one cell type) mixed transcriptional profiles. These gradients can be interpreted as to what extent the model is using these variables to predict each cell type proportions.