I have trained a denoising auotencoder with a training set df_noised_noy_norm_y
in keras. I have another data set df_active
and I made this autoencoder predict it's encoded representation. Now, I want to fine-tune the trained autoencoder with this data set df_active
: in other words, I want to fit the trained autoencoder with this data set df_active
.
Is there an easy and efficient way to acheive that in keras ?
Here is the script of the denoising autoencoder:
checkpointer = ModelCheckpoint(filepath="modelyes.h5",
verbose=0,
save_best_only=True,
save_weights_only=True)
tensorboard = TensorBoard(log_dir='/tmp/autoencoder',
histogram_freq=0,
write_graph=True,
write_images=True)
input_enc_yes = Input(shape=(input_size,))
hidden_1 = Dense(hidden_size1, activation='relu')(input_enc_yes)
hidden_11 = Dense(hidden_size2, activation='relu')(hidden_1)
code_yes = Dense(code_size, activation='relu')(hidden_11)
hidden_22 = Dense(hidden_size2, activation='relu')(code_yes)
hidden_2 = Dense(hidden_size1, activation='relu')(hidden_22)
output_enc_yes = Dense(input_size, activation='tanh')(hidden_2)
D_autoencoder_yes = Model(input_enc_yes, output_enc_yes)
D_autoencoder_yes.compile(optimizer='adam',
loss='mean_squared_error',
metrics=['accuracy'])
history_D_yes = D_autoencoder_yes.fit(df_noised_noy_norm_y, df_noyau_norm_y,
epochs=200,
batch_size=batch_size,
shuffle = True,
validation_data=(df_noised_test_norm_y, df_test_norm_y),
verbose=1,
callbacks=[checkpointer, tensorboard]).history
D_autoencoder_yes.save_weights("modelyes.h5")
D_autoencoder_yes.load_weights("modelyes.h5")