Here is how we proceed with the recipe:
- The first step in tuning hyperparameters is building the model. Build the model in TensorFlow, exactly the way we have been.
- Add a way to save the model in model_file. In TensorFlow, this can be done using a Saver object. Then save it in the session:
... saver = tf.train.Saver() ... with tf.Session() as sess: ... #Do the training steps ... save_path = saver.save(sess, "/tmp/model.ckpt") print("Model saved in file: %s" % save_path)
- Next, identify the hyperparameters that you want to tune.
- Choose possible values for the hyperparameters. Here, you can make a random choice, constant spaced choice, or manual choice. The three are respectively known as random search, grid search, or manual ...