Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

keras autoencoder not converging

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)
like image 753
lab_rat Avatar asked Aug 27 '15 07:08

lab_rat


1 Answers

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.

like image 77
rahulm Avatar answered Nov 02 '22 00:11

rahulm