Model persistence is very important as it enables the reuse of neural network models without having to train more than once. Once the autoencoder is trained to perform outlier detection, we can save the model to the disk for later use. We explained the ModelSerializer class in a previous chapter. We use this to save the autoencoder model.
Saving the resultant model
How to do it...
- Use ModelSerializer to persist the model:
File modelFile = new File("model.zip");
ModelSerializer.writeModel(multiLayerNetwork,file, saveUpdater);
- Add a normalizer to the persisted model:
ModelSerializer.addNormalizerToModel(modelFile,dataNormalization);