Could someone please explain to me why the autoencoder is not converging? To me the results of the two networks below should be the same. However, the autoencoder below is not converging, whereas, the network beneath it is.
# autoencoder implementation, does not converge
autoencoder = Sequential()
encoder = containers.Sequential([Dense(32,16,activation='tanh')])
decoder = containers.Sequential([Dense(16,32)])
autoencoder.add(AutoEncoder(encoder=encoder, decoder=decoder,
output_reconstruction=True))
rms = RMSprop()
autoencoder.compile(loss='mean_squared_error', optimizer=rms)
autoencoder.fit(trainData,trainData, nb_epoch=20, batch_size=64,
validation_data=(testData, testData), show_accuracy=False)
# non-autoencoder implementation, converges
model = Sequential()
model.add(Dense(32,16,activation='tanh'))
model.add(Dense(16,32))
model.compile(loss='mean_squared_error', optimizer=rms)
model.fit(trainData,trainData, nb_epoch=numEpochs, batch_size=batch_size,
validation_data=(testData, testData), show_accuracy=False)
I think Keras's Autoencoder implementation ties the weights of the encoder and decoder, whereas in your implementation, the encoder and decoder have separate weights. If your implementation is leading to much better performance on the test data, then it may indicate that un-tied weights may be needed for your problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With