Question:
I’m trying to implement a RandomizedSearchCV using the ImageDataGenerators.Here an example of the generator used for the train set:
validation_generator
and finally the model has been fitted as:keras_reg
is the KerasClassifier
which wraps the model for sklearn and param_distribs
is the dictionary with the hyperparameters values.Finally I fitted the RandomizedSearchCV object as follows:
Answer:
I don’t recommend the below solution and approch. I highly recommend usingKerasTuner
but If you want to input keras.preprocessing.image.DirectoryIterator
like your train_generator
to RandomizedSearchCV
you need to extract X
and Y
from DirectoryIterator
then input them to RandomizedSearchCV like below:If you have better answer, please add a comment about this, thank you!