How can I save and reload trained autoencoders?

조회 수: 11(최근 30일)
Paul Poloniewicz
Paul Poloniewicz 2017년 10월 18일
댓글: Paul Poloniewicz 2017년 10월 24일
I am trying to save a trained autoencoder so I can reload it at a another point in time and run it. When I try: save autoenc; It saves to a .mat file. When I try: load autoenc; It comes in as a mat object, not an autoencoder. What is the proper way to do this?

답변(1개)

Corey Silva
Corey Silva 2017년 10월 24일
I'm having trouble reproducing what you described. If I do the following, I see the autoencoder loaded just fine.
>> X = abalone_dataset;
>> autoenc = trainAutoencoder(X);
>> save autoenc
>> clear all
>> load autoenc
It's possible you're not using the load/save functions correctly in this context. It might be worth taking a look at the following pages: https://www.mathworks.com/help/matlab/ref/save.html https://www.mathworks.com/help/matlab/ref/load.html
  댓글 수: 1
Paul Poloniewicz
Paul Poloniewicz 2017년 10월 24일
Thanks for your response! Here's what I get:
Trial>> autoenc autoenc = Autoencoder with properties:
HiddenSize: 25
EncoderTransferFunction: 'logsig'
EncoderWeights: [25×784 double]
EncoderBiases: [25×1 double]
DecoderTransferFunction: 'logsig'
DecoderWeights: [784×25 double]
DecoderBiases: [784×1 double]
TrainingParameters: [1×1 struct]
ScaleData: 1
Trial>> TestAutoenc = autoenc
TestAutoenc =
Autoencoder with properties:
HiddenSize: 25
EncoderTransferFunction: 'logsig'
EncoderWeights: [25×784 double]
EncoderBiases: [25×1 double]
DecoderTransferFunction: 'logsig'
DecoderWeights: [784×25 double]
DecoderBiases: [784×1 double]
TrainingParameters: [1×1 struct]
ScaleData: 1
Trial>> save 'SavedAutoenc' autoenc
Trial>> RestoredAutoenc = load('SavedAutoenc.mat')
RestoredAutoenc =
struct with fields: ---(Not an AutoEncoder!)
autoenc: [1×1 Autoencoder]
Trial>> view(RestoredAutoenc)
Error using view (line 73) --- (no such method)
Invalid input arguments
Trial>> view(TestAutoenc) ---(this runs normally)
Trial>>

댓글을 달려면 로그인하십시오.

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by