Tuning the model parameters
It's time to try out different parameters on your model and see how well it performs!
The create_model() function you built in the previous exercise is ready for you to use.
Since fitting the RandomizedSearchCV object would take too long, the results you'd get are printed in the show_results() function.
You could try random_search.fit(X,y) in the console yourself to check it does work after you have built everything else, but you will probably timeout the exercise (so copy your code first if you try this or you can lose your progress!).
You don't need to use the optional epochs and batch_size parameters when building your KerasClassifier object since you are passing them as params to the random search and this works already.
Diese Übung ist Teil des Kurses
Introduction to Deep Learning with Keras
Anleitung zur Übung
- Import 
KerasClassifierfromtensorflow.kerasscikit_learn wrappers. - Use your 
create_modelfunction when instantiating yourKerasClassifier. - Set 
'relu'and'tanh'asactivation, 32, 128, and 256 asbatch_size, 50, 100, and 200epochs, andlearning_rateof 0.1, 0.01, and 0.001. - Pass your converted 
modeland the chosenparamsas you build yourRandomizedSearchCVobject. 
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
# Import KerasClassifier from tensorflow.keras scikit learn wrappers
from tensorflow.keras.wrappers.____ import ____
# Create a KerasClassifier
model = KerasClassifier(build_fn = ____)
# Define the parameters to try out
params = {'activation': [____, ____], 'batch_size': [____, ____, ____], 
          'epochs': [____, ____, ____], 'learning_rate': [____, ____, ____]}
# Create a randomize search cv object passing in the parameters to try
random_search = RandomizedSearchCV(____, param_distributions = ____, cv = KFold(3))
# Running random_search.fit(X,y) would start the search,but it takes too long! 
show_results()