有人可以向我解释为什么自动编码器不收敛吗?对我来说,下面两个网络的结果应该是一样的。然而,下面的自动编码器没有收敛,而它下面的网络却是。
# 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)