This function prepares a SpatialDDLS
object to be saved
as an RDA file when contains a DeconvDLModel
object with
a trained DNN model.
Arguments
- object
SpatialDDLS
object with atrained.data
slot containing aDeconvDLModel
object with a trained DNN model.
Value
A SpatialDDLS
or
DeconvDLModel
object with its trained keras model
transformed from a keras.engine.sequential.Sequential
class into a
list
with its architecture as a JSON-like character object, and its
weights as a list.
Details
Since keras models cannot be saved natively as R objects, this function
saves the structure of the model as a JSON-like character object and its
weights as a list. This allows for the retrieval of the model and making
predictions. It is important to note that the state of the optimizer is not
saved, only the model's architecture and weights. To save the entire model,
please see the saveTrainedModelAsH5
and
loadTrainedModelFromH5
functions.
It is also possible to save a SpatialDDLS
object as an
RDS file with the saveRDS
function without any preparation.