Skip to content

Instantly share code, notes, and snippets.

@iCorv
Created January 15, 2020 17:14
Show Gist options
  • Save iCorv/9ccdda8c57702f5659498ac486935ce7 to your computer and use it in GitHub Desktop.
Save iCorv/9ccdda8c57702f5659498ac486935ce7 to your computer and use it in GitHub Desktop.
# compile the model with adam optimizer and mean squeared error as its loss function
autoencoder.compile(optimizer='adam', loss='mse', metrics=['mse'])
# some constants for training
BATCH_SIZE = 32
SHUFFLE_BUFFER_SIZE = 100
# shuffle and batch the examples
train_dataset = train_dataset.shuffle(SHUFFLE_BUFFER_SIZE).batch(BATCH_SIZE)
eval_dataset = eval_dataset.batch(BATCH_SIZE)
# train the model
autoencoder.fit(train_dataset, epochs=100, validation_data=eval_dataset)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment