Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save analyticsindiamagazine/414f3b977277c7f31af089b0856bf3ca to your computer and use it in GitHub Desktop.
Save analyticsindiamagazine/414f3b977277c7f31af089b0856bf3ca to your computer and use it in GitHub Desktop.
#The hyperparameters & their values to be tested are stored in aspecial type called HParam
HP_NUM_UNITS = hp.HParam('num_units', hp.Discrete([50, 100, 200]))
HP_DROPOUT = hp.HParam('dropout', hp.RealInterval(0.1, 0.3))
HP_OPTIMIZER = hp.HParam('optimizer', hp.Discrete(['adam', 'sgd','nadam']))
#Settinf the Metric to RMSE
METRIC_RMSE = 'RootMeanSquaredError'
#Clear any logs from previous runs
!rm -rf ./logs/
#Creating & configuring log files
with tf.summary.create_file_writer('logs/hparam_tuning').as_default():
hp.hparams_config(
hparams=[HP_NUM_UNITS, HP_DROPOUT, HP_OPTIMIZER],
metrics=[hp.Metric(METRIC_RMSE, display_name='RMSE')]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment