Skip to content
This repository has been archived by the owner on Dec 17, 2021. It is now read-only.

Commit

Permalink
PR submission feedback
Browse files Browse the repository at this point in the history
PR review: alecglassford feedback
 - Move l = tf.keras.layers -> Dense = tf.keras.layers.Dense
 - Add explanation for how to use Hyper parameter tuning with Keras
 - Update notebooks
  • Loading branch information
gogasca committed Apr 30, 2019
1 parent dfb5b25 commit 83d45fb
Show file tree
Hide file tree
Showing 3 changed files with 4,552 additions and 4,268 deletions.
12 changes: 6 additions & 6 deletions census/tf-keras/trainer/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ def create_keras_model(input_dim, learning_rate):
Returns:
The compiled Keras model (still needs to be trained)
"""
l = tf.keras.layers
Dense = tf.keras.layers.Dense
model = tf.keras.Sequential(
[
l.Dense(100, activation=tf.nn.relu, kernel_initializer='uniform',
Dense(100, activation=tf.nn.relu, kernel_initializer='uniform',
input_shape=(input_dim,)),
l.Dense(75, activation=tf.nn.relu),
l.Dense(50, activation=tf.nn.relu),
l.Dense(25, activation=tf.nn.relu),
l.Dense(1, activation=tf.nn.sigmoid)
Dense(75, activation=tf.nn.relu),
Dense(50, activation=tf.nn.relu),
Dense(25, activation=tf.nn.relu),
Dense(1, activation=tf.nn.sigmoid)
])

# Custom Optimizer:
Expand Down
3 changes: 1 addition & 2 deletions census/tf-keras/trainer/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ def train_and_evaluate(args):
validation_data=validation_dataset,
validation_steps=1,
verbose=1,
callbacks=[lr_decay_cb, tensorboard_cb]
)
callbacks=[lr_decay_cb, tensorboard_cb])

export_path = tf.contrib.saved_model.save_keras_model(
keras_model, os.path.join(args.job_dir, 'keras_export'))
Expand Down
Loading

0 comments on commit 83d45fb

Please sign in to comment.