Exercise

Preparing a model for tuning

Let's tune the hyperparameters of a binary classification model that does well classifying the breast cancer dataset.

You've seen that the first step to turn a model into a sklearn estimator is to build a function that creates it. The definition of this function is important since hyperparameter tuning is carried out by varying the arguments your function receives.

Build a simple create_model() function that receives both a learning rate and an activation function as arguments. The Adam optimizer has been imported as an object from tensorflow.keras.optimizers so that you can also change its learning rate parameter.

Instructions

100 XP
  • Set the learning rate of the Adam optimizer object to the one passed in the arguments.
  • Set the hidden layers activations to the one passed in the arguments.
  • Pass the optimizer and the binary cross-entropy loss to the .compile() method.