Skip to content

Instantly share code, notes, and snippets.

@coreyauger
Created May 29, 2018 18:16
Show Gist options
  • Save coreyauger/a64086510da182aa8afc87c1d2141e41 to your computer and use it in GitHub Desktop.
Save coreyauger/a64086510da182aa8afc87c1d2141e41 to your computer and use it in GitHub Desktop.
#################################################################################################
## TRAIN PAST ENCODER
#################################################################################################
x_train_past = data[hold_out:,0:2400]
print("training past on: " + str(x_train_past.shape))
input_past = Input(shape=(x_train_past.shape[1],))
encoded_past = Dense(encoding_dim, activation='relu')(input_past)
decoded_past = Dense(x_train_past.shape[1], activation='linear')(encoded_past)
autoencoder_past = Model(input_past, decoded_past)
autoencoder_past.compile(optimizer='adadelta', loss='mean_squared_error', metrics=['accuracy'])
modelPath_past= savePath+"/models/autoencoder-past-"+str(encoding_dim)+".hdf5"
checkpoint_past = ModelCheckpoint(modelPath_past, monitor='acc', verbose=2, save_best_only=True, mode='max')
history_past = autoencoder_past.fit(x_train_past, x_train_past,
batch_size=batch_size,
epochs=epochs,
verbose=2,
callbacks=[checkpoint_past],
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment