What is the point of executions_per_trial?

I’m tuning a model with keras_tuner using the code below, an after searching the documentation and every forum post I can find, there’s no clear answer to this question.

tuner = RandomSearch(
          hypermodel =  build_model,
          max_trials = 5,
          executions_per_trial = 5,
          hyperparameters = hp,
          tune_new_entries = T,
          objective = 'mse',
          directory = 'C:/Users/Humphrey/Desktop/NN_models/',
          project_name = project_name, 
          overwrite = TRUE
          )

tuner %>% fit_tuner(x = x, y = y, 
                    epochs = 1000, 
                    validation_data = list(x_val, y_val))

The documentation says that executions_per_trial is the number of models that should be built and fit for each trial for robustness purposes. So why is it building several models? I thought there was one model for each combination of hyper parameters and the tuner was working out which is one has the lowest mse, after being trained for a certain number of epochs?

1 Like

Hi @AlkalineIsBad

No, executions_per_trial does not mean the number of models to be built and fit for each trial for robustness purposes. It means the number of times each set of hyperparameters is used to train and evaluate the model for reducing the impact of randomness and ensure the robust results,

The Keras Tuner is a library for picking the optimal set of hyperpramaters for the TF program which is called HyperTuning. In this, Random Search is also a hyperparameter tuning technique that explores different combinations of hyperparameters randomly from a predefined search space.

‘executions_per_trial’ refers to how many times a specific set of hyperparameters is evaluated during the search process.

For example - If you set “executions_per_trial=5” then the model will be trained and evaluated 5 times with different random set of hyperparameter sampled by Random Search.

NOTE : There are few args has been updated and added to the Random Search class. Please have a look at this updated Random Search Keras Tuner.

1 Like