Enable Optimization for your SigOpt Runs
In the AI Experiment case you want SigOpt to suggest parameter values in your script. That means you no longer need to set parameters by assigning hard-coded values to
sigopt.params
objects. To define one script to execute Runs and AI Experiments you can change your previous Run script to define the previously hard-coded defaults with sigopt.params.setdefault
for a single parameter or sigopt.params.setdefaults
for a set of parameters. Let's walk through how to modify your parameters and set up your metrics for optimization.We'll walk through how to modify instrumenting your parameter values for our Keras model. We will set up
activation_fn
and hidden_layer_size
for tuning, and will not tune num_epochs
.Parameterization for a Run
Parameterization for an AI Experiment
sigopt.log_dataset(name="mnist")
(train_images, train_labels), (test_images, test_labels) = tf.keras.datasets.mnist.load_data()
# set model training, architecture parameters and hyperparameters
sigopt.params.num_epochs = 3
sigopt.params.hidden_layer_size = 200
sigopt.params.activation_fn = "relu"
sigopt.log_dataset(name="mnist")
(train_images, train_labels), (test_images, test_labels) = tf.keras.datasets.mnist.load_data()
# set model training, architecture parameters and hyperparameters
sigopt.params.num_epochs = 3
sigopt.params.setdefaults({"activation_fn": "relu", "hidden_layer_size": 200})
You don't have to change anything about your metric parameterization when optimizing. In the Optimize your Model section below, we'll walk you through various approaches to optimizing your metrics and how to set up a SigOpt AI Experiment.