Open volkansevim opened 4 years ago
Here is how tuner works: tuner creates a hp, pass it into build_model as an argument. This is different from the hp that you created. Hence the tuner would not see the hp.Choice in generator as a tuning knob. Search space will only include those created using hp
that gets passed to build_model, or a HyperModel object.
There might be a way to tune generator if you subclass HyperModel to include the generator, and somehow pass the hp between build() and the generator. But I think the simplest thing to try is using preprocessing layers (see https://www.tensorflow.org/api_docs/python/tf/keras/layers/experimental/preprocessing?version=nightly) to put preprocessing in the model itself. Then you can use the normal KT workflow to tune your preprocessing steps.
I have a model that employs a custom generator to generate batches. I want to optimize a hyperparameter inside the generator, for example, the number of classes per batch, P.
I tune model-related parameters inside build_model(). However, I can't figure out how to tune P.
I tried:
The code runs without error, but P does not show up under the search space summary.
Is there any way to tune a generator in Keras tuner?