ยป Keras API reference / KerasTuner / Tuners / RandomSearch Tuner

RandomSearch Tuner

[source]

RandomSearch class

keras_tuner.RandomSearch(
    hypermodel=None,
    objective=None,
    max_trials=10,
    seed=None,
    hyperparameters=None,
    tune_new_entries=True,
    allow_new_entries=True,
    **kwargs
)

Random search tuner.

Arguments

  • hypermodel: Instance of HyperModel class (or callable that takes hyperparameters and returns a Model instance). It is optional when Tuner.run_trial() is overriden and does not use self.hypermodel.
  • objective: A string, keras_tuner.Objective instance, or a list of keras_tuner.Objectives and strings. If a string, the direction of the optimization (min or max) will be inferred. If a list of keras_tuner.Objective, we will minimize the sum of all the objectives to minimize subtracting the sum of all the objectives to maximize. The objective argument is optional when Tuner.run_trial() or HyperModel.fit() returns a single float as the objective to minimize.
  • max_trials: Integer, the total number of trials (model configurations) to test at most. Note that the oracle may interrupt the search before max_trial models have been tested if the search space has been exhausted. Defaults to 10.
  • seed: Optional integer, the random seed.
  • hyperparameters: Optional HyperParameters instance. Can be used to override (or register in advance) hyperparameters in the search space.
  • tune_new_entries: Boolean, whether hyperparameter entries that are requested by the hypermodel but that were not specified in hyperparameters should be added to the search space, or not. If not, then the default value for these parameters will be used. Defaults to True.
  • allow_new_entries: Boolean, whether the hypermodel is allowed to request hyperparameter entries not listed in hyperparameters. Defaults to True.
  • **kwargs: Keyword arguments relevant to all Tuner subclasses. Please see the docstring for Tuner.