Prepare a DigitalDLSorter object that has a DigitalDLSorterDNN object with a trained DNN model. keras models cannot be stored natively as R objects (e.g. RData or RDS files). By saving the structure as a JSON-like character object and the weights as a list, it is possible to retrieve the model and make predictions. Note: with this option, the state of optimizer is not saved, only the architecture and weights.

preparingToSave(object)

Arguments

object

DigitalDLSorter object with the trained.data slot.

Value

A DigitalDLSorter or DigitalDLSorterDNN object with its trained keras model transformed from a keras.engine.sequential.Sequential class into a list with the architecture as a JSON-like character object and the weights as a list.

Details

It is possible to save the entire model as an HDF5 file with the saveTrainedModelAsH5 function and to load it into a DigitalDLSorter object with the loadTrainedModelFromH5 function.

It is also possible to save a DigitalDLSorter object as an RDS file with the saveRDS function without any preparation.